mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
cmd: using testing.B.Loop
Signed-off-by: yajianggroup <yajianggroup@outlook.com>
This commit is contained in:
parent
2872242045
commit
9aba81badc
1 changed files with 1 additions and 1 deletions
|
|
@ -158,7 +158,7 @@ func timedExec(bench bool, execFunc func() ([]byte, uint64, error)) ([]byte, exe
|
||||||
// Do one warm-up run
|
// Do one warm-up run
|
||||||
output, gasUsed, err := execFunc()
|
output, gasUsed, err := execFunc()
|
||||||
result := testing.Benchmark(func(b *testing.B) {
|
result := testing.Benchmark(func(b *testing.B) {
|
||||||
for i := 0; i < b.N; i++ {
|
for b.Loop() {
|
||||||
haveOutput, haveGasUsed, haveErr := execFunc()
|
haveOutput, haveGasUsed, haveErr := execFunc()
|
||||||
if !bytes.Equal(haveOutput, output) {
|
if !bytes.Equal(haveOutput, output) {
|
||||||
panic(fmt.Sprintf("output differs\nhave %x\nwant %x\n", haveOutput, output))
|
panic(fmt.Sprintf("output differs\nhave %x\nwant %x\n", haveOutput, output))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue