Created
December 19, 2019 00:50
-
-
Save kayslay/548fdb720e5c5d5ccf37f5a5a5cf0068 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"runtime" | |
"testing" | |
) | |
// limit to a single processor | |
var _ = runtime.GOMAXPROCS(1) | |
func Benchmark_cpuExampleSequential(b *testing.B) { | |
for n := 0; n < b.N; n++ { | |
cpuExampleSequential() | |
} | |
} | |
func Benchmark_cpuExampleConcurrent(b *testing.B) { | |
for n := 0; n < b.N; n++ { | |
cpuExampleConcurrent() | |
} | |
} | |
func Benchmark_ioExampleSequential(b *testing.B) { | |
for n := 0; n < b.N; n++ { | |
ioExampleSequential() | |
} | |
} | |
func Benchmark_ioExampleConcurrent(b *testing.B) { | |
for n := 0; n < b.N; n++ { | |
ioExampleConcurrent() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment