Skip to content
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

string interning: don't do it - rely on compiled constants #1481

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

s-cork
Copy link
Contributor

@s-cork s-cork commented Nov 22, 2022

Motivation:
str interning for a long running python program could use a lot of memory
our current implementation is also not quite the same as cpython

Our constants are cached during compilation so tests that look for compiled str identity will still work
I actually didn't need to change any tests here.

I adjusted places where we rely on str identity in the code base

This reliance also meant implementing tp$hash for Sk.builtin.str
(The python 2.7 implementation is much easier to follow so I used that)

I adjusted the internals of $name for Sk.builtin.func to be a python string.
There was a test for this in test_functools that expected __name__ to be identical after wrapping

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.

1 participant