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