Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Issue 2829683010: Optimize sizeof(InlineBox) by eliminating class layout padding (Closed)

Created:
3 years, 8 months ago by stanisc
Modified:
3 years, 8 months ago
CC:
chromium-reviews, pdr+renderingwatchlist_chromium.org, zoltan1, blink-reviews-layout_chromium.org, szager+layoutwatch_chromium.org, eae+blinkwatch, leviw+renderwatch, jchaffraix+rendering, blink-reviews
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Optimize 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -6 lines) Patch
M third_party/WebKit/Source/core/layout/line/InlineBox.h View 3 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/layout/line/InlineBox.cpp View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 16 (11 generated)
stanisc
PTAL!
3 years, 8 months ago (2017-04-21 21:05:24 UTC) #8
mstensho (USE GERRIT)
lgtm
3 years, 8 months ago (2017-04-24 08:42:46 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2829683010/1
3 years, 8 months ago (2017-04-24 16:33:01 UTC) #12
commit-bot: I haz the power
Committed patchset #1 (id:1) as https://chromium.googlesource.com/chromium/src/+/8a9eb48c6d24472e6812811ece2bf4a29d2c3747
3 years, 8 months ago (2017-04-24 18:51:42 UTC) #15
brucedawson
3 years, 8 months ago (2017-04-24 19:26:12 UTC) #16
Message was sent while issue was closed.
On 2017/04/24 18:51:42, commit-bot: I haz the power wrote:
> Committed patchset #1 (id:1) as
>
https://chromium.googlesource.com/chromium/src/+/8a9eb48c6d24472e6812811ece2b...

Technically it "eliminates most padding", rather than "eliminates padding", but
great work! I'm very pleased with these results.

Powered by Google App Engine
This is Rietveld 408576698