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

Issue 2833883002: Reduce StyleRule class size by eliminating padding in the layout. (Closed)

Created:
3 years, 8 months ago by stanisc
Modified:
3 years, 8 months ago
Reviewers:
meade_UTC10
CC:
chromium-reviews, blink-reviews-style_chromium.org, blink-reviews-css, dglazkov+blink, apavlov+blink_chromium.org, darktears, blink-reviews, rwlbuis
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Reduce StyleRule class size by eliminating padding in the layout. This change improves the class size from 40 bytes to 32 byte. Considering 16-byte allocation granularity on 64-bit Windows this saves 16 bytes per instance (48 bytes to 32 bytes). When I tested this with cnn.com there were about 7.2K instances of StyleRule after loading the page (14K instances at the peak). That means this change will reduce the memory usage by ~112 KB and lower the peak memory usage by ~219 KB. Layout before the change: class blink::StyleRule [sizeof = 40] : public blink::StyleRuleBase { <padding> (4 bytes) [sizeof=8] blink::CSSSelectorList selector_list_ [sizeof=8] blink::Member<blink::StylePropertySet> properties_ [sizeof=8] blink::Member<blink::CSSLazyPropertyParser> lazy_property_parser_ [sizeof=4] blink::StyleRule::ConsiderForMatching should_consider_for_matching_rules_ <padding> (4 bytes) } Layout after the change: class blink::StyleRule [sizeof = 32] : public blink::StyleRuleBase { [sizeof=4] blink::StyleRule::ConsiderForMatching should_consider_for_matching_rules_ [sizeof=8] blink::CSSSelectorList selector_list_ [sizeof=8] blink::Member<blink::StylePropertySet> properties_ [sizeof=8] blink::Member<blink::CSSLazyPropertyParser> lazy_property_parser_ } BUG=710933 Review-Url: https://codereview.chromium.org/2833883002 Cr-Commit-Position: refs/heads/master@{#466394} Committed: https://chromium.googlesource.com/chromium/src/+/3f80504b4bad121fb16e3e7dad008555baf44905

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+10 lines, -10 lines) Patch
M third_party/WebKit/Source/core/css/StyleRule.h View 2 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/css/StyleRule.cpp View 2 chunks +6 lines, -6 lines 0 comments Download

Messages

Total messages: 15 (10 generated)
stanisc
PTAL!
3 years, 8 months ago (2017-04-20 20:22:50 UTC) #3
sky
While I'm an owner of third_party, you should prefer local owners, especially for blink changes. ...
3 years, 8 months ago (2017-04-20 21:11:14 UTC) #7
meade_UTC10
cool, nice spotting! lgtm
3 years, 8 months ago (2017-04-21 08:27:00 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/2833883002/1
3 years, 8 months ago (2017-04-21 18:06:06 UTC) #12
commit-bot: I haz the power
3 years, 8 months ago (2017-04-21 18:12:39 UTC) #15
Message was sent while issue was closed.
Committed patchset #1 (id:1) as
https://chromium.googlesource.com/chromium/src/+/3f80504b4bad121fb16e3e7dad00...

Powered by Google App Engine
This is Rietveld 408576698