Bug 134258

Summary: [XHR] Realign bool members of XmlHttpRequest to reduce padding
Product: WebKit Reporter: Mahesh Kulkarni <maheshk>
Component: New BugsAssignee: Mahesh Kulkarni <maheshk>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, bunhere, cdumez, commit-queue, gyuyoung.kim, laszlo.gombos, rbuis, sergio
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch bfulgham: review-

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.