Skip to content

Store PyObjectRef in CodeObject constants #2294

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

Merged
merged 12 commits into from
Nov 2, 2020

Conversation

coolreader18
Copy link
Member

@coolreader18 coolreader18 commented Oct 18, 2020

Command Mean [s] Min [s] Max [s] Relative
./rustpython-norm benchmarks/pystone.py 50000 7.610 ± 0.181 7.369 7.927 1.09 ± 0.03
./rustpython-opt3 benchmarks/pystone.py 50000 6.999 ± 0.088 6.888 7.145 1.00

A bit faster, and should be in general better for memory usage. This also paves the way to string interning; ctx.unwrap_constant() can intern strings and that should also improve memory usage and performance (due to str hash caching and identity comparison in dicts).

I also removed the peephole optimizer; I was the one who originally wrote it and I didn't feel like rewriting it to work with the constants vec. I also feel that in general, it was adding too much complexity for not enough benefit. I think we can make a better optimizer, but it definitely has to be something that operates on an already compiled codeobject; the streaming optimizer thing we had with OutputStream just doesn't really work.

I also changed the compiler to use insta for snapshot testing of compilation results

@coolreader18 coolreader18 force-pushed the coolreader18/pyobj-constants branch 2 times, most recently from 148ed98 to b4aad69 Compare October 18, 2020 01:05
@coolreader18 coolreader18 marked this pull request as ready for review October 18, 2020 02:30
@coolreader18 coolreader18 force-pushed the coolreader18/pyobj-constants branch from 68de4aa to 781931c Compare October 20, 2020 04:58
@coolreader18
Copy link
Member Author

@youknowone could you take a look at this yourself?

@youknowone youknowone merged commit 697d6ed into master Nov 2, 2020
@youknowone youknowone deleted the coolreader18/pyobj-constants branch November 2, 2020 15:03
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.

2 participants