Skip to content

shared/types/eth2: use b.Loop in streaming benchmarks - #1197

Merged
0xfornax merged 1 commit into
rocket-pool:masterfrom
daixiheguu:refactor-benchmarks-b-loop
Aug 27, 2026
Merged

shared/types/eth2: use b.Loop in streaming benchmarks#1197
0xfornax merged 1 commit into
rocket-pool:masterfrom
daixiheguu:refactor-benchmarks-b-loop

Conversation

@daixiheguu

Copy link
Copy Markdown
Contributor

Update the SSZ streaming benchmarks to use testing.B.Loop instead of manually iterating over b.N.

This follows the current Go benchmark API and lets the testing package manage loop timing consistently. Benchmark behavior is otherwise unchanged.

bloop: replace "for i := range b.N" or "for range b.N" in a benchmark with "for b.Loop()", and remove any preceding calls to b.StopTimer, b.StartTimer, and b.ResetTimer.

B.Loop intentionally defeats compiler optimizations such as inlining so that the benchmark is not entirely optimized away. Currently, however, it may cause benchmarks to become slower in some cases due to increased allocation;

More info cab see https://go.dev/issue/73137

Signed-off-by: daixiheguu <daixihegu@outlook.com>
@0xfornax
0xfornax merged commit c138b76 into rocket-pool:master Aug 27, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants