Skip to content

Commit

Permalink
Use asv.runner instead of ASVBenchmarkHelper and clean benchmarking l…
Browse files Browse the repository at this point in the history
…ogic

Signed-off-by: Arham Chopra <[email protected]>
  • Loading branch information
arhamchopra committed Aug 25, 2024
1 parent fb36b1b commit 4075b07
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 72 deletions.
20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,24 @@ dockerdown: ## spin up docker compose services for adapter testing
##############
# BENCHMARKS #
##############
.PHONY: benchmark benchmarks benchmark-regen benchmark-view benchmarks-regen benchmarks-view
.PHONY: benchmark benchmarks benchmark-quick benchmarks-quick benchmark-local benchmarks-local benchmark-debug benchmarks-debug benchmark-regen benchmarks-regen benchmark-view benchmarks-view
benchmark: ## run benchmarks
python -m asv run --config csp/benchmarks/asv.conf.jsonc --verbose `git rev-parse --abbrev-ref HEAD`^!

benchmark-quick: ## run quick benchmark
python -m asv run --quick --config csp/benchmarks/asv.conf.jsonc --verbose `git rev-parse --abbrev-ref HEAD`^!

benchmark-local: ## run benchmark using the local env
python -m asv run --python=same --config csp/benchmarks/asv.conf.jsonc --verbose

benchmark-debug: ## debug a failing benchmark
if [ -z "${BENCHMARK_NAME}" ]; then echo 'Usage: make benchmark-debug BENCHMARK_NAME=<name of benchmark> [PARAM_INDEX=<index of param permutation>]'; exit 1; fi
if [ -z "${PARAM_INDEX}" ]; then \
python -m pdb -m asv.benchmark run csp/benchmarks ${BENCHMARK_NAME} "{}" debug_profile.txt debug_results.txt; \
else \
python -m pdb -m asv.benchmark run csp/benchmarks ${BENCHMARK_NAME}-${PARAM_INDEX} "{}" debug_profile.txt debug_results.txt; \
fi;

# https://github.com/airspeed-velocity/asv/issues/1027
# https://github.com/airspeed-velocity/asv/issues/488
benchmark-regen:
Expand All @@ -137,6 +151,9 @@ benchmark-view: ## generate viewable website of benchmark results

# Alias
benchmarks: benchmark
benchmarks-quick: benchmark-quick
benchmarks-local: benchmark-local
benchmarks-debug: benchmark-debug
benchmarks-regen: benchmark-regen
benchmarks-view: benchmark-view

Expand Down Expand Up @@ -202,6 +219,7 @@ clean: ## clean the repository
ifneq ($(OS),Windows_NT)
rm -rf .coverage coverage cover htmlcov logs build dist wheelhouse *.egg-info
rm -rf csp/lib csp/bin csp/include _skbuild
rm -rf debug_*.txt
else
del /s /q .coverage coverage cover htmlcov logs build dist wheelhouse *.egg-info
del /s/ q csp\lib csp\bin csp\include _skbuild
Expand Down
1 change: 0 additions & 1 deletion csp/benchmarks/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from .common import *
63 changes: 0 additions & 63 deletions csp/benchmarks/common.py

This file was deleted.

8 changes: 1 addition & 7 deletions csp/benchmarks/stats/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
from timeit import Timer

import csp
from csp.benchmarks import ASVBenchmarkHelper

__all__ = ("StatsBenchmarkSuite",)


class StatsBenchmarkSuite(ASVBenchmarkHelper):
class StatsBenchmarkSuite:
"""
python -m csp.benchmarks.stats.basic
"""
Expand Down Expand Up @@ -43,8 +42,3 @@ def g():
)
elapsed = timer.timeit(1)
return elapsed


if __name__ == "__main__":
sbs = StatsBenchmarkSuite()
sbs.run_all()

0 comments on commit 4075b07

Please sign in to comment.