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

Consider extracting RawTable into a separate crate #424

Open
stepancheg opened this issue Apr 20, 2023 · 1 comment
Open

Consider extracting RawTable into a separate crate #424

stepancheg opened this issue Apr 20, 2023 · 1 comment

Comments

@stepancheg
Copy link
Contributor

There are two issues with RawTable being in hashbrown crate:

  • extra "feature" in hashbrown crate makes it slightly harder to use (for both crate authors and for users)
  • unnecessary HashMap type in all crates namespaces

About the latter.

We use RawTable heavily, but we don't use hashbrown::HashMap (because it is virtually identical to std). But when doing code completion, hashbrown::HashMap often pops up instead of std::collections::HashMap. And once in a while it even accidentally slips into committed code.

Extracting RawTable in a separate crate would solve this issue.

This is not a big deal, feel free to close the issue if this is not right.

@cuviper
Copy link
Member

cuviper commented Jun 27, 2023

There would also be some compile-time benefit. Just now I was playing with feature-gating the map/set code, and using --no-default-features --features raw went from 0.43s to 0.21s on my Ryzen 5800X. That's not going to be a big deal in the scope of a full project, but it's an improvement nonetheless.

So it doesn't literally have to be a separate crate if the default features are reduced to basically nothing. Separating the semver of RawTable might be useful otherwise though, like if API changes are coordinated with std that don't have any effect on raw users.

I also wonder if std could benefit from stripping the shim HashMap/Set wrappers to use RawTable itself, but that's a bigger consideration.

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

No branches or pull requests

2 participants