blob: 1e79a107e6fec690944fcfc8b15b97d632dc1ecb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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)
}
}
|