Bug 134258 - [XHR] Realign bool members of XmlHttpRequest to reduce padding
Summary: [XHR] Realign bool members of XmlHttpRequest to reduce padding
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mahesh Kulkarni
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-24 11:51 PDT by Mahesh Kulkarni
Modified: 2019-02-15 12:01 PST (History)
8 users (show)

See Also:


Attachments
Patch (3.48 KB, patch)
2014-06-24 11:53 PDT, Mahesh Kulkarni
bfulgham: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mahesh Kulkarni 2014-06-24 11:51:06 PDT
[XHR] Realign bool members of XmlHttpRequest to reduce padding
Comment 1 Mahesh Kulkarni 2014-06-24 11:53:29 PDT
Created attachment 233723 [details]
Patch
Comment 2 Laszlo Gombos 2014-06-24 17:35:00 PDT
+ Alexey
Comment 3 Alexey Proskuryakov 2014-06-24 21:47:43 PDT
I guess it's OK to do, but it also seems pretty pointless. Is there a measurable improvement on any test from this patch?
Comment 4 Mahesh Kulkarni 2014-06-26 08:43:17 PDT
(In reply to comment #3)
> I guess it's OK to do, but it also seems pretty pointless. Is there a measurable improvement on any test from this patch?

ap, with this minor optimization in realigning order of bool members, sizeof(xhr) is down by 16bytes (on 64bit machine. Also generally a good practice to move all small members towards the end of class). Though xhr aren't objects kept for long in memory, idea behind this patch to help readability and good practice (i.e Using bitfields/bitmask saves same amount of memory but effects code readability).
Comment 5 Brent Fulgham 2016-03-14 11:31:09 PDT
Comment on attachment 233723 [details]
Patch

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

This patch is too old to apply cleanly. However, I strongly agree with the code change. Could you please update this so that it applies against current sources?

> Source/WebCore/xml/XMLHttpRequest.h:259
>      bool m_responseCacheIsValid;

If you are making this change, please use C++11 initialization.
Comment 6 Rob Buis 2019-02-15 12:01:56 PST
This is fixed using bitfields in ToT.