testing: fix bloop doc

This CL deletes the compiler detail part from bloop documentation.

Change-Id: I73933707a593d4958e2300416d15e7213f001c3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/724800
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Junyang Shao 2025-11-26 19:15:51 +00:00
parent b194f5d24a
commit fb5156a098

View file

@ -483,14 +483,12 @@ func (b *B) loopSlowPath() bool {
// the timer so cleanup code is not measured.
//
// Within the body of a "for b.Loop() { ... }" loop, arguments to and
// results from function calls and assignment receivers within the loop are kept
// results from function calls and assigned variables within the loop are kept
// alive, preventing the compiler from fully optimizing away the loop body.
// Currently, this is implemented as a compiler transformation that wraps such
// variables with a runtime.KeepAlive intrinsic call. The compiler can recursively
// walk the body of for, if statments, the cases of switch, select statments
// and bracket-braced blocks. This applies only to statements syntactically between
// the curly braces of the loop, and the loop condition must be written exactly
// as "b.Loop()".
// variables with a runtime.KeepAlive intrinsic call. This applies only to
// statements syntactically between the curly braces of the loop, and the loop
// condition must be written exactly as "b.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.