コード例 #1
0
func BenchmarkSortedInsert(b *testing.B) {
	for i := 0; i < b.N; i++ {
		list := skiplist.New()
		for i := 0; i < len(fixture.SortedTestData); i++ {
			list.Set(glennBrownKey(fixture.SortedTestData[i].Key), fixture.SortedTestData[i].Value)
		}
	}
}
コード例 #2
0
func BenchmarkIterate(b *testing.B) {
	list := skiplist.New()
	for i := 0; i < len(fixture.TestData); i++ {
		list.Set(glennBrownKey(fixture.TestData[i].Key), fixture.TestData[i].Value)
	}
	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		e := list.Front()
		for e != nil {
			_ = fixture.Key(e.Key().(glennBrownKey))
			_ = e.Value.(fixture.Value)
			e = e.Next()
		}
	}
}