lbcutil/base58/base58bench_test.go

36 lines
686 B
Go
Raw Normal View History

2015-05-01 19:41:58 +02:00
// Copyright (c) 2013-2014 The btcsuite developers
2014-12-22 17:44:01 +01:00
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package base58_test
import (
"bytes"
"testing"
"github.com/btcsuite/btcutil/base58"
2014-12-22 17:44:01 +01:00
)
func BenchmarkBase58Encode(b *testing.B) {
b.StopTimer()
data := bytes.Repeat([]byte{0xff}, 5000)
b.SetBytes(int64(len(data)))
b.StartTimer()
for i := 0; i < b.N; i++ {
base58.Encode(data)
}
}
func BenchmarkBase58Decode(b *testing.B) {
b.StopTimer()
data := bytes.Repeat([]byte{0xff}, 5000)
encoded := base58.Encode(data)
b.SetBytes(int64(len(encoded)))
b.StartTimer()
for i := 0; i < b.N; i++ {
base58.Decode(encoded)
}
}