summaryrefslogtreecommitdiffstats
path: root/sixel_test.go
blob: eb7f989bff5812379e4f4ff7cc0793a8eb1ca336 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()
		var randState uint64
		quickSelect(myTestSlice, len(myTestSlice)/2, cmp.Compare, &randState)
	}
}