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

Allow frozen strings to cache their hashValue #2991

Open
enebo opened this issue May 26, 2015 · 2 comments
Open

Allow frozen strings to cache their hashValue #2991

enebo opened this issue May 26, 2015 · 2 comments

Comments

@enebo
Copy link
Member

enebo commented May 26, 2015

I am not saying we should do this but we if we accept the extra cost of a field or get clever we can cache the hashValue of a frozen string and literal string lookups can be at same speed as symbols. when unfrozen we need to invalidate that hashValue safely.

There are two sides to this as well. In a non-de-duped non-literal string key (but frozen from being a key we do not need to recalc hash value over and over for the key when traversing a hash bucket. From the client side people who explicitly freeze their strings will get near de-duped performance since object identity will fail but test-key and keys will be cached hash compares.

@dirk
Copy link
Contributor

dirk commented Aug 3, 2015

@enebo: I'd be interested in pursuing this if it's still something you think is worth pursuing (and hasn't already been done).

@enebo
Copy link
Member Author

enebo commented Aug 5, 2015

@dirk with some of our de-dup of symbol issues we might want to wait a bit more on this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants