func BenchmarkSortedInsert(b *testing.B) {
	for i := 0; i < b.N; i++ {
		list := skiplist.NewCustomMap(lt)
		for i := 0; i < len(fixture.SortedTestData); i++ {
			list.Set(fixture.SortedTestData[i].Key, fixture.SortedTestData[i].Value)
		}
	}
}
func BenchmarkIterate(b *testing.B) {
	list := skiplist.NewCustomMap(lt)
	for i := 0; i < len(fixture.TestData); i++ {
		list.Set(fixture.TestData[i].Key, fixture.TestData[i].Value)
	}
	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		for i := list.Iterator(); i.Next(); {
			_ = i.Key().(fixture.Key)
			_ = i.Value().(fixture.Value)
		}
	}
}
Ejemplo n.º 3
0
func NewSkipList(lesser func(l, r interface{}) bool) *skiplistOrderedMap {
	return &skiplistOrderedMap{skiplist.NewCustomMap(lesser)}
}
Ejemplo n.º 4
0
func NewSkipList() *skiplist.SkipList {
	return skiplist.NewCustomMap(func(l, r interface{}) bool {
		return l.(uint64) < r.(uint64)
	})
}