blob: b19414b81c3a7a09204adb636b33c17dc483d3fb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package sixel
import (
"cmp"
"math/rand/v2"
"testing"
)
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))
for b.Loop() {
b.StopTimer()
copy(myTestSlice, testSlice)
b.StartTimer()
quickSelect(myTestSlice, len(myTestSlice)/2, cmp.Compare)
}
}
|