Skip to content

Improve benchmark script's output, fix wrong case, and make easier to run#524

Open
xmo-odoo wants to merge 2 commits into
pallets:mainfrom
xmo-odoo:benchmark
Open

Improve benchmark script's output, fix wrong case, and make easier to run#524
xmo-odoo wants to merge 2 commits into
pallets:mainfrom
xmo-odoo:benchmark

Conversation

@xmo-odoo
Copy link
Copy Markdown

@xmo-odoo xmo-odoo commented May 28, 2026

The "long escape" bench case is the same as "long plain", fix it to actually be a long escape. Also add a "long prefix" to match the "long suffix", and bench prefix galloping modes (if any).

The benchmark script requires pyperf, which is not in any of markupsafe's dependency groups, making it more complicated to run than necessary. By using a PEP 723 dependencies spec, uv run bench.py (or other PEP 723 runners) should work out of the box.

Because the script just prints the results to stdout it's annoying to compare results between implementations, especially when getting stability warnings. By storing the benchmarks into results files, then using compare_to to compare them, we get the same data (kinda, it doesn't print the jitter in table form) which makes things much easier to compare. This requires touching up the naming a bit so compare_to can line up the benches for comparison, but that does not seem detrimental.

Currently the output is fixed to the default table output which I think is the most convenient, but the script could take a parameter to influence that.

And if surfacing benchmark (in)stability is considered important, pyperf check could be run on the benchmark data before printing the results. Dumping the suite files to a non-temp directory (and not deleting them) could also be an option (probably opt-in via a script arg), especially to compare baselines with optimisations (#519).

fixes #523

xmo-odoo and others added 2 commits May 28, 2026 12:10
The "long escape" bench case is the same as "long plain", fix it to actually be a long
escape. Also add a "long prefix" to match the "long suffix", and bench prefix galloping
modes (if any).

The benchmark script requires pyperf, which is not in any of markupsafe's dependency
groups, making it more complicated to run than necessary. By using a PEP 723
dependencies spec, `uv run bench.py` (or other PEP 723 runners) should work out of the
box.

Because the script just prints the results to stdout it's annoying to compare results
between implementations, especially when getting stability warnings. By storing the
benchmarks into results files, then using `compare_to` to compare them, we get the same
data (kinda, it doesn't print the jitter in table form) which makes things much easier
to compare. If we want to surface benchmark stability back, we can run `pyperf check`
before `compare_to`. This requires touching up the naming a bit so `compare_to` can line
up the benches for comparison, but that does not seem detrimental.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bench.py's output is sub-par

1 participant