-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Refactor benchmarking suite to use Criterion and add microbenchmarks #2367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Pystone comparison: Parsing: File comparisons: And the full report: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, this is really great!! Definitely much cleaner than our old setup. I pushed a commit to still allow running pystone
outside the context of the benchmarker, otherwise I think this is good to go!
The main thing I use benchmarks for is determining whether a change I make is actually faster, and by how much. Usually, I just |
Thank you 😊! I wasn't really sure what to add to the micro-benchmarks so I kind of just guessed, but I figured we can add more in the future easily enough. The benchmarks are not perfect right now - the cpython branch included parsing overhead while the rustpython one does not. If you're happy then we could merge this and work on fixing that later, I don't think the overhead is that significant. |
It acts similar to the standard bench library. You'd run the benchmarks on master, then again on your branch. It would tell you the changes in throughout or latency between the two. Any subsequent changes you make would also be benchmarked. But honestly I'm not sure how it would work with your specific workflow, but I do think that it's more extensible and provides a more intuitive way of exploring results than the the standard bench library. Plus it doesn't need nighty, so... 🎉🎉 |
Yeah, that definitely sucks that there's no easy API in the Yeah, I think criterion is definitely better than the nightly benching apis, but I wasn't able to use those the way I do for this and I probably won't be able to use criterion either. Although, maybe I could compile with |
Thanks for contributing! |
If it you want, i can create a web page on rustpython.github.io called "benchmarks". If you can automate the benchmark to run and spit out some images in a directory in https://github.com/RustPython/rustpython.github.io , then it would be trivial to show those on a webpage. is this possible/neat or unnecessary (and demotivating)? |
@mireille-raad I think that will be a fun feature. So one upvote. But it also can be demotivating too :p |
I also think that would be a good idea it would be a good way of tracking performance improvements we make over time. In retrospect, it would've been nice to collect data on the perf changes I've been making over the last couple months, but hindsight is 20/20 🙃 |
well, let's do this then :) I will start a new issue :D |
This PR refactors the benchmark suite to use Criterion (https://docs.rs/criterion/0.3.3/criterion/).
I've completely re-written the benchmarks, which I don't think where running correctly before. Now every file inside
benchmarks/
is both parsed and executed by rustpython + cpython and the results compared. Adding a new benchmark is as simple as adding a file to that directory, and any exceptions while executing the code are correctly displayed to the console rather than just panicking.I've also added an extra benchmark that runs pystone three times with a different step count for both cpython and rustpython and compares the results.
I added the ability to run microbenchmarks quickly and easily. For example to benchmark context manager exceptions you could add:
Only the part after the
# ---
will be benchmarked. Here are the results:We could then also use this github action to run them as part of the CI steps in merge requests.