[
https://issues.apache.org/jira/browse/STATISTICS-84?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17803549#comment-17803549
]
Alex Herbert commented on STATISTICS-84:
----------------------------------------
Updated in commit:
5e3d7ae503da4493fe9131cf7cddb9cfb328f431
The Mean is now over 5x faster on large data than previously when creating from
an array:
||length||name||Score||
|1|Mean|6.1|
|1|SumMean|3.9|
|1|ExtendedSumMean|4.4|
|10|Mean|10.0|
|10|SumMean|5.7|
|10|ExtendedSumMean|8.6|
|1000|Mean|1009.4|
|1000|SumMean|786.9|
|1000|ExtendedSumMean|1010.3|
The precision on the test data has been lowered as the extended precision sum
method is more accurate.
> Create the Mean from array input using a summation
> --------------------------------------------------
>
> Key: STATISTICS-84
> URL: https://issues.apache.org/jira/browse/STATISTICS-84
> Project: Commons Statistics
> Issue Type: Improvement
> Components: descriptive
> Reporter: Alex Herbert
> Priority: Trivial
> Attachments: mean_double_4096.png, mean_float_4096-1.png,
> mean_float_4096.png
>
>
> The creation of the Mean from an array uses the rolling mean algorithm. This
> requires a divide for each input value. The algorithm is slow when compared
> to a simple sum of the values and a divide of the sum. The advantage is that
> the algorithm is overflow safe and computes the mean in a single pass (useful
> for streams).
> In the majority of use cases a sum will not overflow. Change the array
> construction to attempt a sum to compute the mean, reverting to the rolling
> mean if this fails.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)