Skip to content

perf: don't use Option for value#1

Open
mkroening wants to merge 1 commit intophil-opp:masterfrom
mkroening:no-option
Open

perf: don't use Option for value#1
mkroening wants to merge 1 commit intophil-opp:masterfrom
mkroening:no-option

Conversation

@mkroening
Copy link
Contributor

This PR changes the value's type from UnsafeCell<Option<T>> to UnsafeCell<MaybeUninit<T>>, reducing the size of the cell for types without niches.

This is possible since the discriminant of Some in value is also encoded as COMPLETE in state.

@mkroening mkroening force-pushed the no-option branch 2 times, most recently from eadbabe to a8085c4 Compare October 9, 2025 13:02
@mkroening
Copy link
Contributor Author

Unfortunately, I have rediscovered matklad/once_cell#72. See Is there a manual Drop implementation? - Rust Forge.

Hopefully, we will be able to do this on stable in the future. Feel free to close this if you'd rather have this closed in the meantime. :)

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.

1 participant