From 3686c1dcd8cb9ce60f5b9bfd7ac8b8a248eb87a3 Mon Sep 17 00:00:00 2001 From: yajianggroup Date: Tue, 23 Sep 2025 15:58:48 +0800 Subject: [PATCH] consensus: using testing.B.Loop Signed-off-by: yajianggroup --- consensus/ethash/consensus_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/consensus/ethash/consensus_test.go b/consensus/ethash/consensus_test.go index e3793cd1b0..ef8788640b 100644 --- a/consensus/ethash/consensus_test.go +++ b/consensus/ethash/consensus_test.go @@ -151,37 +151,37 @@ func BenchmarkDifficultyCalculator(b *testing.B) { } b.Run("big-frontier", func(b *testing.B) { b.ReportAllocs() - for i := 0; i < b.N; i++ { + for b.Loop() { calcDifficultyFrontier(1000014, h) } }) b.Run("u256-frontier", func(b *testing.B) { b.ReportAllocs() - for i := 0; i < b.N; i++ { + for b.Loop() { CalcDifficultyFrontierU256(1000014, h) } }) b.Run("big-homestead", func(b *testing.B) { b.ReportAllocs() - for i := 0; i < b.N; i++ { + for b.Loop() { calcDifficultyHomestead(1000014, h) } }) b.Run("u256-homestead", func(b *testing.B) { b.ReportAllocs() - for i := 0; i < b.N; i++ { + for b.Loop() { CalcDifficultyHomesteadU256(1000014, h) } }) b.Run("big-generic", func(b *testing.B) { b.ReportAllocs() - for i := 0; i < b.N; i++ { + for b.Loop() { x1(1000014, h) } }) b.Run("u256-generic", func(b *testing.B) { b.ReportAllocs() - for i := 0; i < b.N; i++ { + for b.Loop() { x2(1000014, h) } })