mirror of https://github.com/tidwall/tile38.git
update benchmark
This commit is contained in:
parent
6008a78281
commit
16d0de422b
|
@ -108,17 +108,15 @@ func TestKNN(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkInsert(b *testing.B) {
|
func BenchmarkInsert(b *testing.B) {
|
||||||
|
var rects []*Rect
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
rects = append(rects, wp(randMinMax()))
|
||||||
|
}
|
||||||
rand.Seed(0)
|
rand.Seed(0)
|
||||||
|
b.ReportAllocs()
|
||||||
|
b.ResetTimer()
|
||||||
tr := New()
|
tr := New()
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
min, max := randMinMax()
|
tr.Insert(rects[i])
|
||||||
tr.Insert(wp(min, max))
|
|
||||||
}
|
}
|
||||||
// count := 0
|
|
||||||
// tr.Search([]float64{-116, 32, 20}, []float64{-114, 34, 800}, func(id int) bool {
|
|
||||||
// count++
|
|
||||||
// return true
|
|
||||||
// })
|
|
||||||
// println(count)
|
|
||||||
// //println(tr.Count())
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue