diff options
| author | Paul Buetow <paul@buetow.org> | 2023-04-02 22:22:31 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-04-02 22:22:31 +0300 |
| commit | ce2a50fbba76494dbf146d741ef41a296f088cef (patch) | |
| tree | 130eaa882f09bab447f0f0fdbf1f6d485cf3908f /search | |
| parent | 82486957133f0e0e5227c2c168254b1001b28f03 (diff) | |
refactordevelop
Diffstat (limited to 'search')
| -rw-r--r-- | search/search_test.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/search/search_test.go b/search/search_test.go index 2cb35bc..36ef4bf 100644 --- a/search/search_test.go +++ b/search/search_test.go @@ -12,6 +12,9 @@ const factor int = 10 const minLength int = 1 const maxLength int = 10000 +// Store here so that Go isn't optimizing the benchmark away. +var benchResult interface{} + func TestElementary(t *testing.T) { for i := minLength; i <= maxLength; i *= factor { test[int,int](NewElementary[int,int](), i, t) @@ -142,8 +145,6 @@ func benchmark[K ds.Integer, V ds.Number](s Set[K,V], l int, b *testing.B) { list := ds.NewRandomArrayList[K](l, -1) b.Run(fmt.Sprintf("random(%d)", l), func(b *testing.B) { - var benchResult V - b.ResetTimer() for i, a := range list { s.Put(a, V(i)) @@ -151,7 +152,5 @@ func benchmark[K ds.Integer, V ds.Number](s Set[K,V], l int, b *testing.B) { for _, a := range list { benchResult, _ = s.Get(a) } - - _ = benchResult }) } |
