diff --git a/main_test.go b/main_test.go new file mode 100644 index 0000000..90147f3 --- /dev/null +++ b/main_test.go @@ -0,0 +1,21 @@ +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) +}