spatial/kdtree: fix error in NearestSet benchmark
The NKeeper was not reset each iteration, so after the first call
essentially no work was being done.
MODIFY
spatial/kdtree/kdtree_test.go
spatial/kdtree/kdtree_test.go
@@ -592,10 +592,12 @@ func Benchmark(b *testing.B) {
nk := NewNKeeper(10)
for i := 0; i < b.N; i++ {
tree.NearestSet(nk, Point{rnd.Float64(), rnd.Float64(), rnd.Float64()})
- }
if nk.Len() != 10 {
b.Error("unexpected result length")
}
+ nk.Heap = nk.Heap[:1]
+ nk.Heap[0] = ComparableDist{Dist: inf}
+ }
},
},
{

spatial/kdtree: fix error in NearestSet benchmark

The NKeeper was not reset each iteration, so after the first call
essentially no work was being done.