Hello! Please review and sponsor this small change:
https://bugs.openjdk.java.net/browse/JDK-8151123 http://cr.openjdk.java.net/~tvaleev/webrev/8151123/r1/ User-supplied mapper function is unnecessarily called twice on each accumulation event in summingDouble and averagingDouble. This function could be computationally intensive which may degrade the performance up to 2x. The patch addresses this issue. Here's also simple JMH benchmark which illustrates the performance gain. http://cr.openjdk.java.net/~tvaleev/webrev/8151123/jmh/ Original: Benchmark (n) Mode Cnt Score Error Units AveragingTest.averageDistance 10 avgt 30 0,571 ± 0,049 us/op AveragingTest.averageDistance 1000 avgt 30 58,573 ± 1,194 us/op AveragingTest.averageDistance 100000 avgt 30 5854,428 ± 71,242 us/op Patched: Benchmark (n) Mode Cnt Score Error Units AveragingTest.averageDistance 10 avgt 30 0,336 ± 0,002 us/op AveragingTest.averageDistance 1000 avgt 30 31,932 ± 0,367 us/op AveragingTest.averageDistance 100000 avgt 30 3794,541 ± 21,599 us/op With best regards, Tagir Valeev.