Using the new benchmark, BenchmarkPeakDetector_NextBatch
, it appears the new version is faster by a factor of more than 10. Results may vary depending on the size of the Lag
and how many values after the initialization are processed.
Changes:
- Use Welford's method on initialization.
- Use a similar online algorithm for computing the next mean and population standard deviation.
New references: