Skip to content

Commit 1c5545f

Browse files
authored
Merge branch 'main' into dependabot/pip/pyright-1.1.400
2 parents 5776250 + 5d28c1d commit 1c5545f

3 files changed

Lines changed: 28 additions & 5 deletions

File tree

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,19 +169,28 @@ The flag effect plot shows the effect of specified configuration flags against a
169169
In `bench_runner.toml`, the `flag_effect_plot` table has a `subplots` key which is an array of tables with the following keys:
170170

171171
- `name`: The description of the flags to use in the title.
172+
- `version`: The version series to compare. Should be a 2-part version, e.g. "3.14"
172173
- `head_flags`: A list of flags to use as the head.
173174
- `base_flags`: (optional) A list of flags to use as the base. By default, this is a default build, i.e. no flags.
174-
- `runner_map`: (optional) If you need to map a runner to a base in a different runner, you can provide that mapping here. For example, with tail-calling, you may want to compare runners configured to use clang against runners configured with the "default compiler" for a given platform. The mapping is from the "head" runner nickname to the "base" runner nickname.
175+
- `runner_map`: (optional) If you need to map a runner to a base in a
176+
different runner, you can provide that mapping here. For example, with
177+
tail-calling, you may want to compare runners configured to use clang
178+
against runners configured with the "default compiler" for a given
179+
platform. The mapping is from the "head" runner nickname to the "base"
180+
runner nickname. If `runner_map` is not empty, only the "head" runners in
181+
the map are plotted.
175182

176183
For example:
177184

178185
```toml
179186
[[flag_effect_plot.subplots]]
180187
name = "JIT"
188+
version = "3.14"
181189
head_flags = ["JIT"]
182190

183191
[[flag_effect_plot.subplots]]
184192
name = "Tail calling interpreter"
193+
version = "3.14"
185194
head_flags = ["TAILCALL"]
186195
runner_map = { linux_clang = "linux" }
187196
```

bench_runner/plot.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def get_flag_effect_plot_config():
105105

106106
for subplot in subplots:
107107
assert "name" in subplot
108+
assert "version" in subplot
108109
assert "head_flags" in subplot
109110
subplot["head_flags"] = sorted(set(subplot["head_flags"]))
110111
if "base_flags" not in subplot:
@@ -428,12 +429,14 @@ def flag_effect_plot(
428429
print("No flag effect plot config found. Skipping.")
429430
return
430431

431-
def get_comparison_value(ref, r):
432+
def get_comparison_value(ref, r, force_valid):
432433
key = ",".join((str(ref.filename)[8:], str(r.filename)[8:]))
433434
if key in data:
434435
return data[key]
435436
else:
436-
value = getter(result.BenchmarkComparison(ref, r, "default"))
437+
value = getter(
438+
result.BenchmarkComparison(ref, r, "default", force_valid=force_valid)
439+
)
437440
data[key] = value
438441
return value
439442

@@ -464,8 +467,15 @@ def get_comparison_value(ref, r):
464467

465468
for subplot, ax in zip(subplots, axs):
466469
ax.set_title(f"Effect of {subplot['name']}")
470+
version = tuple(int(x) for x in subplot["version"].split("."))
471+
assert len(version) == 2, (
472+
"Version config in {subplot['name']}" " should only be major.minor"
473+
)
467474

468475
for runner in mrunners.get_runners():
476+
runner_is_mapped = runner.nickname in subplot["runner_map"]
477+
if subplot["runner_map"] and not runner_is_mapped:
478+
continue
469479
head_results = commits.get(runner.nickname, {}).get(
470480
tuple(subplot["head_flags"]), {}
471481
)
@@ -476,10 +486,14 @@ def get_comparison_value(ref, r):
476486
line = []
477487
for cpython_hash, r in head_results.items():
478488
if cpython_hash in base_results:
489+
if r.parsed_version.release[0:2] != version:
490+
continue
479491
line.append(
480492
(
481493
r.commit_datetime,
482-
get_comparison_value(base_results[cpython_hash], r),
494+
get_comparison_value(
495+
base_results[cpython_hash], r, runner_is_mapped
496+
),
483497
)
484498
)
485499
line.sort(key=lambda x: datetime.datetime.fromisoformat(x[0]))

tests/data/bench_runner.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ subplots = [
1818

1919
[flag_effect_plot]
2020
subplots = [
21-
{ name = "JIT", head_flags = ["JIT"] },
21+
{ name = "JIT", version = "3.14", head_flags = ["JIT"] },
2222
]
2323

2424
[publish_mirror]

0 commit comments

Comments
 (0)