aboutsummaryrefslogtreecommitdiffstats
path: root/bench_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'bench_test.go')
-rw-r--r--bench_test.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/bench_test.go b/bench_test.go
index 1047865..1e79a10 100644
--- a/bench_test.go
+++ b/bench_test.go
@@ -7,16 +7,14 @@ import (
)
func BenchmarkQuickSelect(b *testing.B) {
- r := rand.New(rand.NewPCG(0, 0))
- testSlice := make([]int, 3840*2160)
- for i := range testSlice {
- testSlice[i] = r.Int()
- }
- myTestSlice := make([]int, len(testSlice))
+ rng := rand.New(rand.NewPCG(0, 0))
+ myTestCase := make([]int, 3840*2160)
for b.Loop() {
b.StopTimer()
- copy(myTestSlice, testSlice)
+ for i := range myTestCase {
+ myTestCase[i] = rng.Int()
+ }
b.StartTimer()
- quickSelect(myTestSlice, len(myTestSlice)/2, cmp.Compare)
+ quickSelect(myTestCase, len(myTestCase)/2, cmp.Compare)
}
}