[Webkit-unassigned] [Bug 187460] ResourceResponseBase wastes a lot of space because of std::optional<>

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Sep 5 01:08:15 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=187460

--- Comment #51 from Ryosuke Niwa <rniwa at webkit.org> ---
Comment on attachment 373194
  --> https://bugs.webkit.org/attachment.cgi?id=373194
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=373194&action=review

> Source/WebCore/platform/network/ResourceResponseBase.h:70
> +        unsigned type : 3;
> +        unsigned tainting : 2;
>          bool isRedirected;

Type and Training are each one byte if we use uint8_t width so making them bitfields isn't gonna save anything.
We're better off moving httpStatusCode down here so that it's better packed with these enum classes & bool.

> Source/WebCore/platform/network/ResourceResponseBase.h:248
> +    unsigned m_source : 3;
> +    unsigned m_type : 3;
> +    unsigned m_tainting : 2;

Again, we should just use enum class with uint8_t width.
There are 3 uint8_t enum class types here (3 bytes) then if you move m_httpStatusCode here,
that would neatly pack into one word (8 bytes) in 64-bit.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190905/c71fcad9/attachment.html>


More information about the webkit-unassigned mailing list