Improve benchmark script's output, fix wrong case, and make easier to run#524
Open
xmo-odoo wants to merge 2 commits into
Open
Improve benchmark script's output, fix wrong case, and make easier to run#524xmo-odoo wants to merge 2 commits into
xmo-odoo wants to merge 2 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_toto 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 socompare_tocan 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 checkcould 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