TODO: 修改到所有的数据结构里

This commit is contained in:
eson 2019-04-06 04:08:27 +08:00
parent 65621872f8
commit eb954ffb47

View File

@ -507,11 +507,20 @@ func BenchmarkGodsRBGet(b *testing.B) {
l := loadTestData()
b.N = len(l)
for i := 0; i < b.N; i++ {
tree.Put(l[i], l[i])
}
b.ResetTimer()
b.StartTimer()
for i := 0; i < b.N; i++ {
tree.Get(l[i])
execCount := 10
b.N = len(l) * execCount
for i := 0; i < execCount; i++ {
for _, v := range l {
tree.Get(v)
}
}
}
@ -520,11 +529,20 @@ func BenchmarkGodsAvlGet(b *testing.B) {
l := loadTestData()
b.N = len(l)
for i := 0; i < b.N; i++ {
tree.Put(l[i], l[i])
}
b.ResetTimer()
b.StartTimer()
for i := 0; i < b.N; i++ {
tree.Get(l[i])
execCount := 10
b.N = len(l) * execCount
for i := 0; i < execCount; i++ {
for _, v := range l {
tree.Get(v)
}
}
}