benchmark 转移到其他仓库

This commit is contained in:
2019-05-08 17:33:58 +08:00
parent d718d87cd6
commit deaf8cde25
18 changed files with 3082 additions and 3075 deletions

View File

@@ -222,39 +222,39 @@ func TestRemove(t *testing.T) {
}
func BenchmarkGet(b *testing.B) {
pl := New(compare.Int)
// func BenchmarkGet(b *testing.B) {
// pl := New(compare.Int)
l := loadTestData()
// l := loadTestData()
for _, v := range l {
pl.Push(v)
}
// for _, v := range l {
// pl.Push(v)
// }
b.ResetTimer()
b.StartTimer()
b.N = len(l)
// b.ResetTimer()
// b.StartTimer()
// b.N = len(l)
for i := 0; i < b.N; i++ {
if i%2 == 0 {
pl.Get(i)
}
}
// for i := 0; i < b.N; i++ {
// if i%2 == 0 {
// pl.Get(i)
// }
// }
}
func BenchmarkInsert(b *testing.B) {
// }
// func BenchmarkInsert(b *testing.B) {
l := loadTestData()
// l := loadTestData()
b.ResetTimer()
b.StartTimer()
// b.ResetTimer()
// b.StartTimer()
execCount := 1
b.N = len(l) * execCount
for i := 0; i < execCount; i++ {
pl := New(compare.Int)
for _, v := range l {
pl.Push(v)
}
}
}
// execCount := 1
// b.N = len(l) * execCount
// for i := 0; i < execCount; i++ {
// pl := New(compare.Int)
// for _, v := range l {
// pl.Push(v)
// }
// }
// }