@@ -17,6 +17,8 @@ import (
1717 "github.com/gaissmai/bart/internal/art"
1818)
1919
20+ var uintSliceSink []uint
21+
2022func TestInverseIndex (t * testing.T ) {
2123 t .Parallel ()
2224 for i := range maxItems {
@@ -279,9 +281,10 @@ func BenchmarkNodePrefixesAsSlice(b *testing.B) {
279281 }
280282
281283 b .Run (fmt .Sprintf ("Set %d" , nPrefixes ), func (b * testing.B ) {
284+ buf := make ([]uint , maxItems )
282285 b .ResetTimer ()
283286 for range b .N {
284- anySink = this .prefixes .AsSlice (make ([] uint , 0 , maxItems ) )
287+ uintSliceSink = this .prefixes .AsSlice (buf )
285288 }
286289 })
287290 }
@@ -299,7 +302,7 @@ func BenchmarkNodePrefixesAll(b *testing.B) {
299302 b .Run (fmt .Sprintf ("Set %d" , nPrefixes ), func (b * testing.B ) {
300303 b .ResetTimer ()
301304 for range b .N {
302- anySink = this .prefixes .All ()
305+ uintSliceSink = this .prefixes .All ()
303306 }
304307 })
305308
@@ -387,9 +390,10 @@ func BenchmarkNodeChildrenAsSlice(b *testing.B) {
387390 }
388391
389392 b .Run (fmt .Sprintf ("Set %d" , nchilds ), func (b * testing.B ) {
393+ buf := make ([]uint , maxItems )
390394 b .ResetTimer ()
391395 for range b .N {
392- anySink = this .children .AsSlice (make ([] uint , 0 , maxItems ) )
396+ uintSliceSink = this .children .AsSlice (buf )
393397 }
394398 })
395399 }
@@ -407,7 +411,7 @@ func BenchmarkNodeChildrenAll(b *testing.B) {
407411 b .Run (fmt .Sprintf ("Set %d" , nchilds ), func (b * testing.B ) {
408412 b .ResetTimer ()
409413 for range b .N {
410- anySink = this .children .All ()
414+ uintSliceSink = this .children .All ()
411415 }
412416 })
413417 }
0 commit comments