-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Extend the "nullable pointer optimization" to two different size variants #43507
Comments
So basically the char would just occupy the same memory as the length field of the slice? I think the example should use a Also I think this needs an RFC. Also note the related RFC issue: rust-lang/rfcs#1230 |
Right.
Thanks for the link. Should I close this issue in favor of rust-lang/rfcs#1230? This optimization was mentioned in the comment. |
Yes, I think this is best tracked there -- we need an RFC to make changes in this area, I believe. |
Play:
currently prints (on x86_64) 16, 16 and 24. But it could potentially be 16, 16 and 16.
This optimization should be possible if we have an enum with two variants
a
andb
, thea
variant contains non-nullable field and the size of a is greater than the size of b (probably size of b should be a divisor of size of a or 0 for alignment).The current "nullable pointer optimization" is a special case with size of b equal to 0.
src link
The text was updated successfully, but these errors were encountered: