-
Notifications
You must be signed in to change notification settings - Fork 799
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
Passive elements and data are now PrimaryMaps #2183
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all thanks for the description of what this PR is doing / what it's for.
I'm not sure if I believe that the data here is not sparse. It doesn't start sparse but with elem_drop
it looks like it could be become sparse.
Given the diff I've just seen, it looks like the change is correct, but I'm a bit concerned about the change in semantics of this type. There could easily be code not included in this diff which doesn't do the is_empty
check and is broken by this change. I think using Option
instead of a sentinel value will be less error prone and more explicit. There's no runtime cost to using Option<Box<T>>
instead of Box<T>
, but the users will now have to deal with a potentially None
value, which they were theoretically doing before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! the get
logic can be cleaned up a bit but otherwise 👍
bors r+ |
Description
This PR moves some fields in the
ModuleInfo
to stop usingHashMap
and start usingPrimaryMap
as the contents are not sparse but fully dense.The PR is incentivized by #2180 as it's partially needed to stop using HashMap when possible. It doesn't completely solve it, as the
function_names
field is still aHashMap
, but it should be trivial to solve that in a PR that improves the deserialization time.Review