Skip to content

Commit a44d662

Browse files
arhamchopratimkpaine
authored andcommitted
Use asv.runner instead of ASVBenchmarkHelper and clean benchmarking logic
Signed-off-by: Arham Chopra <[email protected]>
1 parent 9d1b961 commit a44d662

File tree

4 files changed

+21
-72
lines changed

4 files changed

+21
-72
lines changed

Makefile

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

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

141155
# Alias
142156
benchmarks: benchmark
157+
benchmarks-quick: benchmark-quick
158+
benchmarks-local: benchmark-local
159+
benchmarks-debug: benchmark-debug
143160
benchmarks-regen: benchmark-regen
144161
benchmarks-view: benchmark-view
145162

@@ -205,9 +222,11 @@ clean: ## clean the repository
205222
ifneq ($(OS),Windows_NT)
206223
rm -rf .coverage coverage cover htmlcov logs build dist wheelhouse *.egg-info
207224
rm -rf csp/lib csp/bin csp/include _skbuild
225+
rm -rf debug_*.txt
208226
else
209227
del /s /q .coverage coverage cover htmlcov logs build dist wheelhouse *.egg-info
210228
del /s/ q csp\lib csp\bin csp\include _skbuild
229+
del debug_*.txt
211230
endif
212231

213232
################

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)