aboutsummaryrefslogtreecommitdiffstats
path: root/bench_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'bench_test.go')
-rw-r--r--bench_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/bench_test.go b/bench_test.go
new file mode 100644
index 0000000..1e79a10
--- /dev/null
+++ b/bench_test.go
@@ -0,0 +1,20 @@
+package main
+
+import (
+ "cmp"
+ "math/rand/v2"
+ "testing"
+)
+
+func BenchmarkQuickSelect(b *testing.B) {
+ rng := rand.New(rand.NewPCG(0, 0))
+ myTestCase := make([]int, 3840*2160)
+ for b.Loop() {
+ b.StopTimer()
+ for i := range myTestCase {
+ myTestCase[i] = rng.Int()
+ }
+ b.StartTimer()
+ quickSelect(myTestCase, len(myTestCase)/2, cmp.Compare)
+ }
+}