diff options
| author | Junyang Shao <shaojunyang@google.com> | 2025-02-21 16:23:36 +0000 |
|---|---|---|
| committer | Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2025-03-03 10:37:29 -0800 |
| commit | f48b53f0f62c94fac8d835c8e1b48fab5b842bd3 (patch) | |
| tree | 48e965b26d70222f5bf2a9f9a5c650d6b16728b5 /src/testing | |
| parent | 0312e31ed197b3bf1434e8dbb283f0d2374d7457 (diff) | |
| download | go-f48b53f0f62c94fac8d835c8e1b48fab5b842bd3.tar.xz | |
testing: fix testing.B.Loop doc on loop condition
As mentioned by
https://github.com/golang/go/issues/61515#issuecomment-2656656554,
the documentation should be relaxed.
Change-Id: I9f18301e1a4e4d9a72c9fa0b1132b1ba3cc57b03
Reviewed-on: https://go-review.googlesource.com/c/go/+/651435
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Commit-Queue: Junyang Shao <shaojunyang@google.com>
Diffstat (limited to 'src/testing')
| -rw-r--r-- | src/testing/benchmark.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/testing/benchmark.go b/src/testing/benchmark.go index 3a7da9e540..6919341ef7 100644 --- a/src/testing/benchmark.go +++ b/src/testing/benchmark.go @@ -426,9 +426,9 @@ func (b *B) loopSlowPath() bool { // The compiler never optimizes away calls to functions within the body of a // "for b.Loop() { ... }" loop. This prevents surprises that can otherwise occur // if the compiler determines that the result of a benchmarked function is -// unused. The loop must be written in exactly this form, and this only applies -// to calls syntactically between the curly braces of the loop. Optimizations -// are performed as usual in any functions called by the loop. +// unused. The loop condition must be written in exactly as "b.Loop()", and this +// only applies to calls syntactically between the curly braces of the loop. +// Optimizations are performed as usual in any functions called by the loop. // // After Loop returns false, b.N contains the total number of iterations that // ran, so the benchmark may use b.N to compute other average metrics. |
