OSDN Git Service

new repo
[bytom/vapor.git] / test / performance / mining_test.go
1 package performance
2
3 import (
4         "os"
5         "testing"
6
7         dbm "github.com/tendermint/tmlibs/db"
8
9         "github.com/vapor/account"
10         "github.com/vapor/mining"
11         "github.com/vapor/test"
12 )
13
14 // Function NewBlockTemplate's benchmark - 0.05s
15 func BenchmarkNewBlockTpl(b *testing.B) {
16         testDB := dbm.NewDB("testdb", "leveldb", "temp")
17         defer os.RemoveAll("temp")
18
19         chain, _, txPool, err := test.MockChain(testDB)
20         if err != nil {
21                 b.Fatal(err)
22         }
23         accountManager := account.NewManager(testDB, chain)
24
25         b.ResetTimer()
26         for i := 0; i < b.N; i++ {
27                 mining.NewBlockTemplate(chain, txPool, accountManager)
28         }
29 }