Closed Bug 1301004 Opened 9 years ago Closed 9 years ago

Make Maybe take less space

Categories

(Core :: MFBT, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1287006
Tracking Status
firefox51 --- affected

People

(Reporter: xidorn, Unassigned)

Details

Maybe<> currently is a boolean and an AlignedStorage2, and AlignedStorage2 is basically a union of an uint64_t and the target type. It means that Maybe<> at least costs 16 bytes on all platforms, which sounds very unfortunate, especially when it is used with a one-byte type like enums, another bool, etc.
Summary: Make Maybe take fewer space → Make Maybe take less space
This space is getting crowded! We already have: Bug 1073559 - sizeof(Maybe<T>) >= 16 on win32 Bug 1127639 - Pack Maybe<T> better Bug 1287006 - Optimize Maybe's members for packing (And I myself was playing with ways to optionally overlap a distinct "nothing" value with the stored type where possible.) So I guess it's definitely a popular itch that needs scratching. Maybe we could all work together? Or we're all busy on other important work, so whoever can do it first wins! :-)
Haha. I guess we should pick only one and mark others duplicate to that one. I'm not going to do this at this moment, but if no one takes it, I may probably take it later :)
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.