add bench to makefile

This commit is contained in:
onyx-and-iris 2024-12-01 21:14:30 +00:00
parent 1ea679ebe3
commit 475ccfe0ba
3 changed files with 19 additions and 4 deletions

View File

@ -2,5 +2,14 @@ goos: linux
goarch: amd64
pkg: github.com/onyx-and-iris/aoc2024/day-01
cpu: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
BenchmarkMain-12 1000000000 0.001628 ns/op
ok github.com/onyx-and-iris/aoc2024/day-01 0.015s
BenchmarkMain-12 1000000000 0.001576 ns/op
BenchmarkMain-12 1000000000 0.001731 ns/op
BenchmarkMain-12 1000000000 0.001616 ns/op
BenchmarkMain-12 1000000000 0.001597 ns/op
BenchmarkMain-12 1000000000 0.001559 ns/op
BenchmarkMain-12 1000000000 0.001657 ns/op
BenchmarkMain-12 1000000000 0.001542 ns/op
BenchmarkMain-12 1000000000 0.001561 ns/op
BenchmarkMain-12 1000000000 0.001574 ns/op
BenchmarkMain-12 1000000000 0.001582 ns/op
ok github.com/onyx-and-iris/aoc2024/day-01 0.126s

View File

@ -8,7 +8,7 @@ EXE := $(BIN_DIR)/$(program)
.DEFAULT_GOAL := build
.PHONY: fmt vet build clean
.PHONY: fmt vet build bench clean
fmt:
$(GO) fmt ./...
@ -18,6 +18,9 @@ vet: fmt
build: vet | $(BIN_DIR)
$(GO) build -o $(EXE) .
bench:
$(GO) test . -test.count=10 -bench=. > benchmark
$(BIN_DIR):
@mkdir -p $@

View File

@ -21,7 +21,7 @@ EXE := \$(BIN_DIR)/\$(program)
.DEFAULT_GOAL := build
.PHONY: fmt vet build clean
.PHONY: fmt vet build bench clean
fmt:
\$(GO) fmt ./...
@ -31,6 +31,9 @@ vet: fmt
build: vet | \$(BIN_DIR)
\$(GO) build -o \$(EXE) ./\$(SRC_DIR)
bench:
\$(GO) test . -test.count=10 -bench=. > benchmark
\$(BIN_DIR):
@mkdir -p \$@