feat: add go-bench command
This commit is contained in:
parent
26f146a39c
commit
15479c4978
2 changed files with 18 additions and 0 deletions
|
@ -6,3 +6,6 @@
|
|||
|
||||
@bench-go: build-go
|
||||
hyperfine './go/a < ./input.txt'
|
||||
|
||||
@go-bench:
|
||||
cd go && go test -bench=.
|
||||
|
|
15
go/main_test.go
Normal file
15
go/main_test.go
Normal file
|
@ -0,0 +1,15 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
const N int = 100_000_000
|
||||
|
||||
var num int = 10
|
||||
|
||||
func BenchmarkAdd1(b *testing.B) {
|
||||
for i := 0; i < N; i++ {
|
||||
_ = num * num
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue