Skip to content

Conversation

sfackler
Copy link
Member

SmallIntSet is equivalent to BitvSet but with 64 times the memory
overhead. There's no reason for it to exist.

SmallIntSet's overhead should really only be 8 times, but for some
reason, sys::size_of::<Option<()>>() == 8, not 1.

@huonw
Copy link
Contributor

huonw commented Jul 20, 2013

The reason that Option<()> is 8 bytes is because the discriminant is always word size, rather than shrinking to be the minimum possible (#1647).

@thestinger
Copy link
Contributor

I don't think these are really equivalent. If you add 1, 2 and 3 to SmallIntSet, it will contain them as 3 distinct elements. If you only insert 1 and 2, it will not contain 3. I might be misunderstanding what BitvSet is, but I thought it was a set of bits.

@huonw
Copy link
Contributor

huonw commented Jul 21, 2013

@thestinger nth bit set == n in the BitvSet. (At least, that's the current semantics.)

@thestinger
Copy link
Contributor

Ah.

@huonw
Copy link
Contributor

huonw commented Jul 21, 2013

@sfackler needs a rebase.

@sfackler
Copy link
Member Author

@huonw Done.

SmallIntSet is equivalent to BitvSet but with 8 times the memory
overhead. There's no reason for it to exist.
bors added a commit that referenced this pull request Jul 23, 2013
SmallIntSet is equivalent to BitvSet but with 64 times the memory
overhead. There's no reason for it to exist.

SmallIntSet's overhead should really only be 8 times, but for some
reason, `sys::size_of::<Option<()>>() == 8`, not 1.
@bors bors closed this Jul 23, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Nov 23, 2021
Fix ICE in undocumented_unsafe_blocks

changelog: Fix ICE in [`undocumented_unsafe_blocks`]

closes: rust-lang#7934
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.

5 participants