mirror of
https://github.com/luxfi/container.git
synced 2026-09-24 00:24:34 +00:00
32 lines
497 B
Go
32 lines
497 B
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package sampler
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func BenchmarkUniform(b *testing.B) {
|
|
sizes := []uint64{
|
|
30,
|
|
35,
|
|
500,
|
|
10000,
|
|
100000,
|
|
}
|
|
for _, size := range sizes {
|
|
b.Run(fmt.Sprintf("%d elements uniformly", size), func(b *testing.B) {
|
|
s := NewUniform()
|
|
|
|
s.Initialize(size)
|
|
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
_, _ = s.Sample(30)
|
|
}
|
|
})
|
|
}
|
|
}
|