Einführung in die Sprache Go anhand von Beispielen
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
655 B

package main
import (
"testing"
)
//Namenskonvention: Benchmark…
func BenchmarkMeineIrgendwieBenannteTestingFunction(b *testing.B) {
//maxThreads = int8(runtime.NumCPU())
//maxRoutines = maxThreads * ThreadFaktor
//runtime.GOMAXPROCS(int(maxThreads))
testzahl := [...]int{5769977777, 8978793242417717171, 8978793242417717169, 11, 8}
for i := 0; i < b.N; i++ {
for j := range testzahl {
_ = is_prime(&j)
}
}
}
/* Siehe auch Profiling:
$ go test -cpuprofile cpu.prof -memprofile mem.prof -bench .
$ go tool pprof cpu.prof
Entering interactive mode (type "help" for commands)
(pprof) png > Schaubild.png
(pprof) weblist
(pprof) help
*/