Skip to content

Commit 4075b07

Browse files
committed
Use asv.runner instead of ASVBenchmarkHelper and clean benchmarking logic
Signed-off-by: Arham Chopra <[email protected]>
1 parent fb36b1b commit 4075b07

File tree

4 files changed

+20
-72
lines changed

4 files changed

+20
-72
lines changed

Makefile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,24 @@ dockerdown: ## spin up docker compose services for adapter testing
121121
##############
122122
# BENCHMARKS #
123123
##############
124-
.PHONY: benchmark benchmarks benchmark-regen benchmark-view benchmarks-regen benchmarks-view
124+
.PHONY: benchmark benchmarks benchmark-quick benchmarks-quick benchmark-local benchmarks-local benchmark-debug benchmarks-debug benchmark-regen benchmarks-regen benchmark-view benchmarks-view
125125
benchmark: ## run benchmarks
126126
python -m asv run --config csp/benchmarks/asv.conf.jsonc --verbose `git rev-parse --abbrev-ref HEAD`^!
127127

128+
benchmark-quick: ## run quick benchmark
129+
python -m asv run --quick --config csp/benchmarks/asv.conf.jsonc --verbose `git rev-parse --abbrev-ref HEAD`^!
130+
131+
benchmark-local: ## run benchmark using the local env
132+
python -m asv run --python=same --config csp/benchmarks/asv.conf.jsonc --verbose
133+
134+
benchmark-debug: ## debug a failing benchmark
135+
if [ -z "${BENCHMARK_NAME}" ]; then echo 'Usage: make benchmark-debug BENCHMARK_NAME=<name of benchmark> [PARAM_INDEX=<index of param permutation>]'; exit 1; fi
136+
if [ -z "${PARAM_INDEX}" ]; then \
137+
python -m pdb -m asv.benchmark run csp/benchmarks ${BENCHMARK_NAME} "{}" debug_profile.txt debug_results.txt; \
138+
else \
139+
python -m pdb -m asv.benchmark run csp/benchmarks ${BENCHMARK_NAME}-${PARAM_INDEX} "{}" debug_profile.txt debug_results.txt; \
140+
fi;
141+
128142
# https://github.com/airspeed-velocity/asv/issues/1027
129143
# https://github.com/airspeed-velocity/asv/issues/488
130144
benchmark-regen:
@@ -137,6 +151,9 @@ benchmark-view: ## generate viewable website of benchmark results
137151

138152
# Alias
139153
benchmarks: benchmark
154+
benchmarks-quick: benchmark-quick
155+
benchmarks-local: benchmark-local
156+
benchmarks-debug: benchmark-debug
140157
benchmarks-regen: benchmark-regen
141158
benchmarks-view: benchmark-view
142159

@@ -202,6 +219,7 @@ clean: ## clean the repository
202219
ifneq ($(OS),Windows_NT)
203220
rm -rf .coverage coverage cover htmlcov logs build dist wheelhouse *.egg-info
204221
rm -rf csp/lib csp/bin csp/include _skbuild
222+
rm -rf debug_*.txt
205223
else
206224
del /s /q .coverage coverage cover htmlcov logs build dist wheelhouse *.egg-info
207225
del /s/ q csp\lib csp\bin csp\include _skbuild

csp/benchmarks/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
from .common import *

csp/benchmarks/common.py

Lines changed: 0 additions & 63 deletions
This file was deleted.

csp/benchmarks/stats/basic.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
from timeit import Timer
44

55
import csp
6-
from csp.benchmarks import ASVBenchmarkHelper
76

87
__all__ = ("StatsBenchmarkSuite",)
98

109

11-
class StatsBenchmarkSuite(ASVBenchmarkHelper):
10+
class StatsBenchmarkSuite:
1211
"""
1312
python -m csp.benchmarks.stats.basic
1413
"""
@@ -43,8 +42,3 @@ def g():
4342
)
4443
elapsed = timer.timeit(1)
4544
return elapsed
46-
47-
48-
if __name__ == "__main__":
49-
sbs = StatsBenchmarkSuite()
50-
sbs.run_all()

0 commit comments

Comments
 (0)