Esempio n. 1
0
func BenchmarkPopcountClearLsb(b *testing.B) {
	var x uint64
	x = 0
	for i := 0; i < b.N; i++ {
		_ = popcountClearLsb.PopCount(x)
	}
}
Esempio n. 2
0
func main() {
	fmt.Println(popcount.PopCount(4))
	fmt.Println(popcountLoop.PopCount(4))
	fmt.Println(popcountClearLsb.PopCount(4))
	fmt.Println(popcountShift64.PopCount(4))
	br := testing.Benchmark(BenchmarkPopcount)
	fmt.Println(br)
	br = testing.Benchmark(BenchmarkPopcountLoop)
	fmt.Println(br)
	br = testing.Benchmark(BenchmarkPopcountShift64)
	fmt.Println(br)
	br = testing.Benchmark(BenchmarkPopcountClearLsb)
	fmt.Println(br)
}