github.com/johnathanhowell/sia@v0.5.1-beta.0.20160524050156-83dcc3d37c94/modules/consensus/consensusset_bench_test.go (about)

     1  package consensus
     2  
     3  import (
     4  	"strconv"
     5  	"testing"
     6  )
     7  
     8  // BenchmarkCreateServerTester benchmarks creating a server tester from
     9  // scratch. The consensus package creates over 60 server testers (and
    10  // counting), and optimizations to the server tester creation process are
    11  // likely to generalize to the project as a whole.
    12  //
    13  // i7-4770, 1d60d69: 22.883 ms / op
    14  func BenchmarkCreateServerTester(b *testing.B) {
    15  	for i := 0; i < b.N; i++ {
    16  		cst, err := createConsensusSetTester("BenchmarkCreateServerTester - " + strconv.Itoa(i))
    17  		if err != nil {
    18  			b.Fatal(err)
    19  		}
    20  		cst.Close()
    21  	}
    22  }