BENCHMARKS := evaluate
FEATURES ?=
BENCHMARK ?= $(BENCHMARKS)
ITERATIONS ?= 5
FLAGS := $(if $(FEATURES),--features $(FEATURES))
.PHONY: benchmark check profile test
benchmark:
@set -e; \
for name in $(BENCHMARK); do \
executable=$$( \
cargo bench $(FLAGS) --bench $$name --no-run --message-format=json \
| sed -n 's/.*"executable":"\([^"]*\)".*/\1/p' \
| tail -n 1 \
); \
test -n "$$executable"; \
"$$executable" "$(ITERATIONS)"; \
done
check:
cargo clippy --all-targets $(FLAGS) -- -D warnings
profile:
@mkdir -p target/profiles
@set -e; \
for name in $(BENCHMARK); do \
executable=$$( \
cargo bench $(FLAGS) --bench $$name --no-run --message-format=json \
| sed -n 's/.*"executable":"\([^"]*\)".*/\1/p' \
| tail -n 1 \
); \
test -n "$$executable"; \
samply record --save-only --unstable-presymbolicate -o "target/profiles/$$name.json" -- "$$executable" "$(ITERATIONS)"; \
done
test:
cargo test $(FLAGS)