func BInsert(b *testing.B, sm api.StoredMap) { var k string l := len(UniqKey) b.ReportAllocs() b.SetBytes(2) b.ResetTimer() for i := 0; i < b.N; i++ { k = UniqKey[i%l] sm.Insert(k, k) } }
func BThreadsInsert(b *testing.B, sm api.StoredMap) { l := len(UniqKey) b.SetParallelism(CntBenchWorks) b.ReportAllocs() b.SetBytes(2) b.ResetTimer() b.RunParallel(func(pb *testing.PB) { var k string var i int for pb.Next() { k = UniqKey[i%l] sm.Insert(k, k) i++ } }) }