]> Cypherpunks repositories - gostls13.git/commitdiff
testing: fix testing.B.Loop doc on loop condition
authorJunyang Shao <shaojunyang@google.com>
Fri, 21 Feb 2025 16:23:36 +0000 (16:23 +0000)
committerGo LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Mon, 3 Mar 2025 18:37:29 +0000 (10:37 -0800)
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>

src/testing/benchmark.go

index 3a7da9e54012b7fc559cf1836f3538b596d80dbf..6919341ef7a4fe86be5d66ee7587a44061d00167 100644 (file)
@@ -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.