Chromium Code Reviews
DescriptionOptimize sizeof(InlineBox) by eliminating padding
Considering that on 64-bit Windows allocations are done with 16 byte
granularity this reduces the per-instance memory usage of
InlineBox by 16 bytes - from 80 bytes to 64 bytes.
My estimate is that on a typical page where are 1K to 2K instances of
InlineBox and derived classes. And on text heavy page like Reddit topic
discussion I counted 6.7K instances. That means that the estimated memory
saving is anywhere from 16 KB to 100 KB per Renderer processes.
Class layout before the change:
class blink::InlineBox [sizeof = 72]
: public blink::DisplayItemClient {
<padding> (4 bytes)
[sizeof=4] blink::InlineBox::InlineBoxBitfields bitfields_
<padding> (4 bytes)
[sizeof=8] blink::InlineBox* next_
[sizeof=8] blink::InlineBox* prev_
[sizeof=8] blink::InlineFlowBox* parent_
[sizeof=8] blink::LineLayoutItem line_layout_item_
[sizeof=8] blink::LayoutPoint location_
[sizeof=4] blink::LayoutUnit logical_width_
<padding> (4 bytes)
}
class layout after the change:
class blink::InlineBox [sizeof = 64]
: public blink::DisplayItemClient {
<padding> (4 bytes)
[sizeof=8] blink::InlineBox* next_
[sizeof=8] blink::InlineBox* prev_
[sizeof=8] blink::InlineFlowBox* parent_
[sizeof=8] blink::LineLayoutItem line_layout_item_
[sizeof=8] blink::LayoutPoint location_
[sizeof=4] blink::LayoutUnit logical_width_
[sizeof=4] blink::InlineBox::InlineBoxBitfields bitfields_
}
BUG=710933
Review-Url: https://codereview.chromium.org/2829683010
Cr-Commit-Position: refs/heads/master@{#466699}
Committed: https://chromium.googlesource.com/chromium/src/+/8a9eb48c6d24472e6812811ece2bf4a29d2c3747
Patch Set 1 #
Messages
Total messages: 16 (11 generated)
|
||||||||||||||||||||||||||||