Tendermint <-> Application refactor

This commit is contained in:
Jae Kwon
2015-12-01 20:12:01 -08:00
parent a8dc417cd9
commit ef43af19ab
401 changed files with 2401 additions and 76617 deletions

39
benchmarks/map_test.go Normal file
View File

@ -0,0 +1,39 @@
package main
import (
. "github.com/tendermint/go-common"
"testing"
)
func BenchmarkSomething(b *testing.B) {
b.StopTimer()
numItems := 100000
numChecks := 100000
keys := make([]string, numItems)
for i := 0; i < numItems; i++ {
keys[i] = RandStr(32)
}
txs := make([]string, numChecks)
for i := 0; i < numChecks; i++ {
txs[i] = RandStr(32)
}
b.StartTimer()
counter := 0
for j := 0; j < b.N; j++ {
foo := make(map[string]string)
for _, key := range keys {
foo[key] = key
}
for _, tx := range txs {
if _, ok := foo[tx]; ok {
counter++
}
}
for _, tx := range txs {
if _, ok := foo[tx]; ok {
counter++
}
}
}
}