NEW 189272
[WTF] Add support for compactly storing multiple optional members in a class
https://bugs.webkit.org/show_bug.cgi?id=189272
Summary [WTF] Add support for compactly storing multiple optional members in a class
Sam Weinig
Reported 2018-09-04 13:54:03 PDT
Created attachment 348845 [details] Proof of concept When you have a class that has multiple std::optional members (and you aren't using CompactOptional from https://bugs.webkit.org/show_bug.cgi?id=189231) you end up wasting a lot of space due to the bool each std::optional must contain. I think we can do better. An initial idea, attached as a proof of concept, is to store the bools all together as a bitset and have each optional member be able to access that bitset via some OBJECT_OFFSETOF fun. This requires a bit of macro nastiness and bit more typing per optional value, so I am not 100% sure it's worth it.
Attachments
Proof of concept (9.08 KB, text/x-csrc)
2018-09-04 13:54 PDT, Sam Weinig
no flags
Note You need to log in before you can comment on or make changes to this bug.