示例#1
0
func BenchmarkInsertionReflect(b *testing.B) {
	less := func(a, b reflect.Value) bool {
		return a.Int() < b.Int()
	}

	list := getList()

	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		InsertionReflect(list, less)
	}

	// Store the result to avoid compiler optimization
	resultList = list
}