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

Implement by-reference interning. #1042

Open
ryzhyk opened this issue Aug 12, 2021 · 0 comments
Open

Implement by-reference interning. #1042

ryzhyk opened this issue Aug 12, 2021 · 0 comments

Comments

@ryzhyk
Copy link
Contributor

ryzhyk commented Aug 12, 2021

This branch implements an optimization whereby we intern values by reference, avoiding cloning the value in the common case that the same value already exists in the interner. Unfortunately, this optimization doesn't work with the internment crate due to the issue described here: https://github.com/droundy/internment/blob/260c9d90ed336dc31212086828de0a5d8f2890ef/src/lib.rs#L521. This is in turn due to the HashMap::get() requiring the key argument to implement Borrow. One workaround is to use the raw HashMap API, which is currently unstable: https://doc.rust-lang.org/std/collections/struct.HashMap.html#method.raw_entry.

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

1 participant