apache / apache/jmeter

SamplingStatCalculator#addSample resulting value takes time to compute, and it is rarely used

Open
#5,938 0 comments 0 reactions 0 assignees View on GitHub
enhancement performance
Dominant language
Java
Stars
9.5k
Forks
2.3k
Avg merge
1d 22h
Merged PRs (30d)
5

Description

### Use case

`org.apache.jmeter.visualizers.SamplingStatCalculator#addSample` computes `mean`, `median`, `50%` (in addition to `median`), and the values are typically ignored.

https://github.com/apache/jmeter/blob/049cc3a69443b218eaec761b56ada221842e46d0/src/core/src/main/java/org/apache/jmeter/visualizers/SamplingStatCalculator.java#L199-L211

Here's how the resulting value is ignored:
https://github.com/apache/jmeter/blob/049cc3a69443b218eaec761b56ada221842e46d0/src/components/src/main/java/org/apache/jmeter/visualizers/StatVisualizer.java#L124-L133

### Possible solution

Create separate methods for updating and retrieving the values.
It might make sense to use `LongAdder` or even `HdrHistogram` for the summary.

It might make sense to combine `SamplingStatCalculator` and `Calculator`

### Possible workarounds

_No response_

### JMeter Version

5.5

### Java Version

_No response_

### OS Version

_No response_

### See also

* https://github.com/apache/jmeter/pull/380
* https://github.com/apache/jmeter/issues/5769

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.