Skip to content

Commit b6449a3

Browse files
committed
test: improved benchmarks
1 parent 2a7fa27 commit b6449a3

1 file changed

Lines changed: 31 additions & 26 deletions

File tree

bench/bench.py

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ def runner(request):
9292
return request.config._valgrind_runner
9393

9494

95+
CACHE_SIM_OPTIONS = [
96+
"--cache-sim=yes",
97+
"--I1=32768,8,64",
98+
"--D1=32768,8,64",
99+
"--LL=8388608,16,64",
100+
]
101+
95102
def pytest_generate_tests(metafunc):
96103
"""Parametrize tests with valgrind configurations."""
97104
if "tool_and_args" in metafunc.fixturenames:
@@ -103,61 +110,56 @@ def pytest_generate_tests(metafunc):
103110
# Format: (tool, args, config_name)
104111
all_configs = [
105112
# Callgrind configurations
106-
("callgrind", ["--read-inline-info=no"], "callgrind/no-inline"),
107-
("callgrind", ["--read-inline-info=yes"], "callgrind/inline"),
113+
("callgrind", ["--read-inline-info=no"], "cg/no-inline"),
114+
("callgrind", ["--read-inline-info=yes"], "cg/inline"),
108115
(
109116
"callgrind",
110117
[
118+
*CACHE_SIM_OPTIONS,
111119
"--trace-children=yes",
112-
"--cache-sim=yes",
113-
"--I1=32768,8,64",
114-
"--D1=32768,8,64",
115-
"--LL=8388608,16,64",
116120
"--collect-systime=nsec",
117121
"--compress-strings=no",
118122
"--combine-dumps=yes",
119123
"--dump-line=no",
120124
"--read-inline-info=yes",
121125
],
122-
"callgrind/full-with-inline",
126+
"cg/full-inline",
123127
),
124128
(
125129
"callgrind",
126130
[
131+
*CACHE_SIM_OPTIONS,
127132
"--trace-children=yes",
128-
"--cache-sim=yes",
129-
"--I1=32768,8,64",
130-
"--D1=32768,8,64",
131-
"--LL=8388608,16,64",
132133
"--collect-systime=nsec",
133134
"--compress-strings=no",
134135
"--combine-dumps=yes",
135136
"--dump-line=no",
137+
"--read-inline-info=no",
136138
],
137-
"callgrind/full-no-inline",
139+
"cg/full-no-inline",
138140
),
139141
# Tracegrind configurations (only available in codspeed fork)
140-
("tracegrind", [], "tracegrind/default"),
142+
("tracegrind", ["--read-inline-info=no"], "tg/no-inline"),
143+
("tracegrind", ["--read-inline-info=yes"], "tg/inline"),
141144
(
142145
"tracegrind",
143146
[
144-
"--cache-sim=yes",
145-
"--I1=32768,8,64",
146-
"--D1=32768,8,64",
147-
"--LL=8388608,16,64",
147+
*CACHE_SIM_OPTIONS,
148+
"--trace-children=yes",
149+
"--collect-systime=nsec",
150+
"--read-inline-info=no",
148151
],
149-
"tracegrind/cache-sim",
152+
"tg/full-no-inline",
150153
),
151154
(
152155
"tracegrind",
153156
[
154-
"--cache-sim=yes",
155-
"--I1=32768,8,64",
156-
"--D1=32768,8,64",
157-
"--LL=8388608,16,64",
157+
*CACHE_SIM_OPTIONS,
158+
"--trace-children=yes",
158159
"--collect-systime=nsec",
160+
"--read-inline-info=yes",
159161
],
160-
"tracegrind/cache-sim+systime",
162+
"tg/full-inline",
161163
),
162164
]
163165

@@ -174,11 +176,14 @@ def pytest_generate_tests(metafunc):
174176
# If the valgrind version is from CodSpeed, we don't want to display the exact version
175177
# to allow comparison against older versions.
176178
if ".codspeed" in runner.valgrind_version:
177-
runner.valgrind_version = "valgrind.codspeed"
179+
runner.valgrind_version = "codspeed"
180+
# Clean valgrind version names
181+
else:
182+
runner.valgrind_version.removeprefix("valgrind-")
178183

179184
# Create test IDs with format: valgrind-version, command, config-name
180185
test_ids = [
181-
f"{runner.valgrind_version}, {runner.cmd}, {config_name}"
186+
f"{runner.valgrind_version}/{config_name}, {runner.cmd}"
182187
for _, _, config_name in configs
183188
]
184189

@@ -243,7 +248,7 @@ def pytest_configure(self, config):
243248
config._valgrind_runner = runner
244249

245250
exit_code = pytest.main(
246-
[__file__, "-v", "--codspeed", "--codspeed-warmup-time=0", "--codspeed-max-time=5"],
251+
[__file__, "-v", "--codspeed", "--codspeed-warmup-time=0", "--codspeed-max-time=30"],
247252
plugins=[RunnerPlugin()],
248253
)
249254
if exit_code != 0 and exit_code != 5:

0 commit comments

Comments
 (0)