Chromium Code Reviews
DescriptionReduce 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 #
Messages
Total messages: 15 (10 generated)
|
||||||||||||||||||||||||||||