Codebase list golang-github-beorn7-perks / 5f34d75
quantile: Use an if instead of math.Min This significantly speeds up targeted streams when epsilon is small because the invariant is called a lot. benchmark old ns/op new ns/op delta BenchmarkInsertTargetedSmallEpsilon 611 442 -27.66% BenchmarkInsertTargeted 188 171 -9.04% BenchmarkInsertBiasedSmallEpsilon 833 914 +9.72% BenchmarkQuery 105 97.5 -7.14% BenchmarkInsertBiased 176 172 -2.27% BenchmarkQuerySmallEpsilon 6599 6500 -1.50% Caleb Spare 9 years ago
1 changed file(s) with 3 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
6868 } else {
6969 f = (2 * s.epsilon * (s.n - r)) / (1 - q)
7070 }
71 m = math.Min(m, f)
71 if f < m {
72 m = f
73 }
7274 }
7375 return m
7476 }