github.com/palcoin-project/palcd@v1.0.0/blockchain/bench_test.go (about) 1 // Copyright (c) 2015 The btcsuite developers 2 // Use of this source code is governed by an ISC 3 // license that can be found in the LICENSE file. 4 5 package blockchain 6 7 import ( 8 "testing" 9 10 "github.com/palcoin-project/palcutil" 11 ) 12 13 // BenchmarkIsCoinBase performs a simple benchmark against the IsCoinBase 14 // function. 15 func BenchmarkIsCoinBase(b *testing.B) { 16 tx, _ := palcutil.NewBlock(&Block100000).Tx(1) 17 b.ResetTimer() 18 for i := 0; i < b.N; i++ { 19 IsCoinBase(tx) 20 } 21 } 22 23 // BenchmarkIsCoinBaseTx performs a simple benchmark against the IsCoinBaseTx 24 // function. 25 func BenchmarkIsCoinBaseTx(b *testing.B) { 26 tx := Block100000.Transactions[1] 27 b.ResetTimer() 28 for i := 0; i < b.N; i++ { 29 IsCoinBaseTx(tx) 30 } 31 }