From 0a3a97022ee47014ab5bf6064353b990072c22f4 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 6 Dec 2017 11:37:09 +0100 Subject: [PATCH] crypto: fix BenchmarkSha3 The extra output confuses tools like benchstat. --- crypto/crypto_test.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/crypto/crypto_test.go b/crypto/crypto_test.go index 92302948ed..b4c441e5f7 100644 --- a/crypto/crypto_test.go +++ b/crypto/crypto_test.go @@ -20,12 +20,10 @@ import ( "bytes" "crypto/ecdsa" "encoding/hex" - "fmt" "io/ioutil" "math/big" "os" "testing" - "time" "github.com/ethereum/go-ethereum/common" ) @@ -44,13 +42,9 @@ func TestKeccak256Hash(t *testing.T) { func BenchmarkSha3(b *testing.B) { a := []byte("hello world") - amount := 1000000 - start := time.Now() - for i := 0; i < amount; i++ { + for i := 0; i < b.N; i++ { Keccak256(a) } - - fmt.Println(amount, ":", time.Since(start)) } func TestSign(t *testing.T) {