Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify and extend the benchmarks of timing histograms
Replace the use of a clock abstraction with direct provision of the time-reading function. Add benchmarks of two ways to fetch and use a vector member. Following are the results using the revised benchmark suite. (base) mspreitz@mjs12 prometheusextension % go test -benchmem -run=^$ -bench Histogram . goos: darwin goarch: amd64 pkg: k8s.io/component-base/metrics/prometheusextension cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz BenchmarkTimingHistogramDirect-16 28562178 39.47 ns/op 0 B/op 0 allocs/op BenchmarkTimingHistogramVecEltCached-16 29268819 39.41 ns/op 0 B/op 0 allocs/op BenchmarkTimingHistogramVecEltFetched-16 8345041 142.5 ns/op 32 B/op 1 allocs/op BenchmarkWeightedHistogram-16 49803134 24.22 ns/op 0 B/op 0 allocs/op BenchmarkHistogram-16 41756210 29.40 ns/op 0 B/op 0 allocs/op PASS ok k8s.io/component-base/metrics/prometheusextension 6.488s (base) mspreitz@mjs12 prometheusextension % go test -benchmem -run=^$ -bench Histogram . goos: darwin goarch: amd64 pkg: k8s.io/component-base/metrics/prometheusextension cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz BenchmarkTimingHistogramDirect-16 28246786 39.60 ns/op 0 B/op 0 allocs/op BenchmarkTimingHistogramVecEltCached-16 29318173 39.44 ns/op 0 B/op 0 allocs/op BenchmarkTimingHistogramVecEltFetched-16 8441341 142.5 ns/op 32 B/op 1 allocs/op BenchmarkWeightedHistogram-16 48469184 24.21 ns/op 0 B/op 0 allocs/op BenchmarkHistogram-16 41001742 29.51 ns/op 0 B/op 0 allocs/op PASS ok k8s.io/component-base/metrics/prometheusextension 6.340s (base) mspreitz@mjs12 prometheusextension % go test -benchmem -run=^$ -bench Histogram . goos: darwin goarch: amd64 pkg: k8s.io/component-base/metrics/prometheusextension cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz BenchmarkTimingHistogramDirect-16 28983674 40.82 ns/op 0 B/op 0 allocs/op BenchmarkTimingHistogramVecEltCached-16 29527742 43.83 ns/op 0 B/op 0 allocs/op BenchmarkTimingHistogramVecEltFetched-16 8238685 143.8 ns/op 32 B/op 1 allocs/op BenchmarkWeightedHistogram-16 49594070 24.24 ns/op 0 B/op 0 allocs/op BenchmarkHistogram-16 41100378 29.35 ns/op 0 B/op 0 allocs/op PASS ok k8s.io/component-base/metrics/prometheusextension 6.554s Kubernetes-commit: f3068efcfb9f61586dcfae4b87bd084628d53428
- Loading branch information