Example #1
0
func BenchmarkHashPut(b *testing.B) {
	strs := randStrs(1000)
	x := make(map[string]int)
	b.ReportAllocs()
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		x[strs[i%len(strs)]] = randutil.Int()
	}
}
Example #2
0
func BenchmarkTriePut(b *testing.B) {

	strs := randBytes(1000)
	x := NewTrie()
	b.ReportAllocs()
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		x = x.Put(strs[i%len(strs)], randutil.Int())
	}
}