Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fqdn: Fix benchmarking for fqdn cache test
Rather than testing a number of iterations of the core update function here, the test was varying the data input size. This was violating the recommendations from the Go docs, which state: The benchmark function must run the target code b.N times. During benchmark execution, b.N is adjusted until the benchmark function lasts long enough to be timed reliably. This could lead to unreliable benchmarking numbers. Fix it. Example run: $ go test ./pkg/fqdn -bench BenchmarkFqdnCache ... goos: linux goarch: amd64 pkg: github.com/cilium/cilium/pkg/fqdn cpu: 13th Gen Intel(R) Core(TM) i7-1365U BenchmarkFqdnCache-12 100 110924076 ns/op PASS ok github.com/cilium/cilium/pkg/fqdn 11.505s Suggested-by: Fabio Falzoi <fabio.falzoi@isovalent.com> Signed-off-by: Joe Stringer <joe@cilium.io>
- Loading branch information