diff --git a/go/go.justfile b/go/go.justfile index f382c0f..c016bb1 100644 --- a/go/go.justfile +++ b/go/go.justfile @@ -6,3 +6,6 @@ @bench-go: build-go hyperfine './go/a < ./input.txt' + +@go-bench: + cd go && go test -bench=. diff --git a/go/main_test.go b/go/main_test.go new file mode 100644 index 0000000..2f1b34a --- /dev/null +++ b/go/main_test.go @@ -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 + } +}