Skip to content

Commit f48b53f

Browse files
JunyangShaoGo LUCI
authored and
Go LUCI
committed
testing: fix testing.B.Loop doc on loop condition
As mentioned by #61515 (comment), 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>
1 parent 0312e31 commit f48b53f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/testing/benchmark.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,9 @@ func (b *B) loopSlowPath() bool {
426426
// The compiler never optimizes away calls to functions within the body of a
427427
// "for b.Loop() { ... }" loop. This prevents surprises that can otherwise occur
428428
// if the compiler determines that the result of a benchmarked function is
429-
// unused. The loop must be written in exactly this form, and this only applies
430-
// to calls syntactically between the curly braces of the loop. Optimizations
431-
// are performed as usual in any functions called by the loop.
429+
// unused. The loop condition must be written in exactly as "b.Loop()", and this
430+
// only applies to calls syntactically between the curly braces of the loop.
431+
// Optimizations are performed as usual in any functions called by the loop.
432432
//
433433
// After Loop returns false, b.N contains the total number of iterations that
434434
// ran, so the benchmark may use b.N to compute other average metrics.

0 commit comments

Comments
 (0)