Exemple #1
0
func BEachFullCicle(b *testing.B, sm api.StoredMap) {
	b.ReportAllocs()
	b.SetBytes(2)
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		sm.Each(func(m api.Mapper) {
			_ = m.Value().(string)
		})
	}
}
Exemple #2
0
func BThreadsEachShort(b *testing.B, sm api.StoredMap) {
	b.SetParallelism(CntBenchWorks)
	b.ReportAllocs()
	b.SetBytes(2)
	b.ResetTimer()
	b.RunParallel(func(pb *testing.PB) {
		var i int
		for pb.Next() {
			sm.Each(func(m api.Mapper) {
				_ = m.Value().(string)
				m.Stop()
			})
			i++
		}
	})
}