1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-29 23:07:45 +02:00

Comment on linear vs binary search

This commit is contained in:
jmacd
2020-05-21 11:09:10 -07:00
parent db993ec5cc
commit 2aa0f1496e
4 changed files with 46 additions and 28 deletions

View File

@@ -227,7 +227,7 @@ func calcBuckets(points []metric.Number, profile test.Profile) []uint64 {
counts := make([]uint64, len(sortedBoundaries)+1)
idx := 0
for _, p := range points {
for idx < len(sortedBoundaries) && p.CoerceToFloat64(profile.NumberKind) >= boundaries[idx] {
for idx < len(sortedBoundaries) && p.CoerceToFloat64(profile.NumberKind) >= sortedBoundaries[idx] {
idx++
}
counts[idx]++