diff options
| author | Junyang Shao <shaojunyang@google.com> | 2024-11-14 07:34:51 +0800 |
|---|---|---|
| committer | Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-11-20 23:19:48 +0000 |
| commit | 558f5372fc524e69ade3ab3fe36b1913a4095398 (patch) | |
| tree | b95143bb0a6d8db5e4811626afb2b26575dbf8df /test/inline_testingbloop.go | |
| parent | 60299c251364c6f4a830721e4953230260d118a0 (diff) | |
| download | go-558f5372fc524e69ade3ab3fe36b1913a4095398.tar.xz | |
cmd/compile,testing: implement one-time rampup logic for testing.B.Loop
testing.B.Loop now does its own loop scheduling without interaction with b.N.
b.N will be updated to the actual iterations b.Loop controls when b.Loop returns false.
This CL also added tests for fixed iteration count (benchtime=100x case).
This CL also ensured that b.Loop() is inlined.
For #61515
Change-Id: Ia15f4462f4830ef4ec51327520ff59910eb4bb58
Reviewed-on: https://go-review.googlesource.com/c/go/+/627755
Reviewed-by: Michael Pratt <mpratt@google.com>
Commit-Queue: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'test/inline_testingbloop.go')
| -rw-r--r-- | test/inline_testingbloop.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/test/inline_testingbloop.go b/test/inline_testingbloop.go index 9d5138e2d8..cbdf905993 100644 --- a/test/inline_testingbloop.go +++ b/test/inline_testingbloop.go @@ -19,13 +19,19 @@ func cannotinline(b *testing.B) { // ERROR "b does not escape" "cannot inline ca for i := 0; i < b.N; i++ { caninline(1) // ERROR "inlining call to caninline" } - for b.Loop() { // ERROR "skip inlining within testing.B.loop" + for b.Loop() { // ERROR "skip inlining within testing.B.loop" "inlining call to testing\.\(\*B\)\.Loop" caninline(1) } for i := 0; i < b.N; i++ { caninline(1) // ERROR "inlining call to caninline" } - for b.Loop() { // ERROR "skip inlining within testing.B.loop" + for b.Loop() { // ERROR "skip inlining within testing.B.loop" "inlining call to testing\.\(\*B\)\.Loop" + caninline(1) + } + for i := 0; i < b.N; i++ { + caninline(1) // ERROR "inlining call to caninline" + } + for b.Loop() { // ERROR "skip inlining within testing.B.loop" "inlining call to testing\.\(\*B\)\.Loop" caninline(1) } } |
