]> Cypherpunks repositories - gostls13.git/commit
testing: enable better loop time measurement for benchmarking.
authorsunnymilk <shaojunyang@google.com>
Thu, 12 Sep 2024 19:23:37 +0000 (12:23 -0700)
committerJunyang Shao <shaojunyang@google.com>
Fri, 20 Sep 2024 19:10:01 +0000 (19:10 +0000)
commit402dc98759b4708beebcd0729f308bb0c03d3ed6
tree5b0851a4bb693aef120d383a6fe6137e9a89b7c6
parent6600a871ef7376b151cb7e4073c4095209f112ca
testing: enable better loop time measurement for benchmarking.

With b.Loop() in place, the time measurement of loop scaling could be improved to be tighter. By identifying the first call to b.Loop(), we can avoid measuring the expensive ramp-up time by reset the timer tightly before the loop starts. The remaining loop scaling logic of b.N style loop is largely reused.

For #61515.

Change-Id: Ia7b8f0a8838f57c00ac6c5ef779d86f8d713c9b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/612835
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/testing/benchmark.go