22 lines
418 B
Go
22 lines
418 B
Go
|
package main
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func testGeneratePrimes(upperLimit int64, useTensors bool, b *testing.B) {
|
||
|
var config Config
|
||
|
config.DontLoad = true
|
||
|
config.UseTensors = useTensors
|
||
|
|
||
|
for i := 0; i < b.N; i++ {
|
||
|
generatePrimes(upperLimit, config)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func BenchmarkPrimes1000CPU(b *testing.B) {
|
||
|
testGeneratePrimes(1000, false, b)
|
||
|
}
|
||
|
|
||
|
func BenchmarkPrimes1000GPU(b *testing.B) {
|
||
|
testGeneratePrimes(1000, true, b)
|
||
|
}
|