TODO: 修改到所有的数据结构里
This commit is contained in:
parent
65621872f8
commit
eb954ffb47
@ -507,11 +507,20 @@ func BenchmarkGodsRBGet(b *testing.B) {
|
|||||||
|
|
||||||
l := loadTestData()
|
l := loadTestData()
|
||||||
b.N = len(l)
|
b.N = len(l)
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
tree.Put(l[i], l[i])
|
||||||
|
}
|
||||||
|
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
b.StartTimer()
|
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()
|
l := loadTestData()
|
||||||
b.N = len(l)
|
b.N = len(l)
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
tree.Put(l[i], l[i])
|
||||||
|
}
|
||||||
|
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
b.StartTimer()
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user