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

Issue 2844223002: Add heuristic to order non bit fields in ComputedStyleBase. (Closed)

Created:
3 years, 7 months ago by shend
Modified:
3 years, 7 months ago
Reviewers:
meade_UTC10, Bugs Nash
CC:
blink-reviews, chromium-reviews
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Add heuristic to order non bit fields in ComputedStyleBase. Currently, when we generate non bit fields, we order them in alphabetical order. This may result in unnecessary padding, e.g. struct { char a; /* char padding[3] */ int b; char c; /* char padding[3] */ }; See [1] for an explanation. This patch defines an ordering on field types so that we can sort non bit fields from largest alignment size to smallest. This heuristic minimises the padding most of the time: struct { int b; char a; char c; /* char padding[2] */ }; This is purely a memory optimisation, not speed. It does not take into account data access patterns and cache locality. We use the data from [2] to define the order of types. With this heuristic, some of the generated code has changed, but it is unlikely to have changed the size of any structs. Diff of generated files: https://gist.github.com/darrnshn/81d146c2696ef100d56309e5b4b529ff/revisions [1] http://www.drdobbs.com/cpp/padding-and-rearranging-structure-member/240007649?pgno=2 [2] https://codereview.chromium.org/2841413002 BUG=628043 Review-Url: https://codereview.chromium.org/2844223002 Cr-Commit-Position: refs/heads/master@{#468293} Committed: https://chromium.googlesource.com/chromium/src/+/e8abebbc560bc64554c06e0480c2c9e75b0d3d32

Patch Set 1 #

Patch Set 2 : Rebase #

Total comments: 4

Patch Set 3 : Address comments #

Patch Set 4 : Assert #

Unified diffs Side-by-side diffs Delta from patch set Stats (+38 lines, -9 lines) Patch
M third_party/WebKit/Source/build/scripts/make_computed_style_base.py View 1 2 3 3 chunks +38 lines, -9 lines 0 comments Download

Messages

Total messages: 36 (25 generated)
shend
Hi Bugs, PTAL :)
3 years, 7 months ago (2017-04-27 07:37:24 UTC) #7
Bugs Nash
lgtm https://codereview.chromium.org/2844223002/diff/20001/third_party/WebKit/Source/build/scripts/make_computed_style_base.py File third_party/WebKit/Source/build/scripts/make_computed_style_base.py (right): https://codereview.chromium.org/2844223002/diff/20001/third_party/WebKit/Source/build/scripts/make_computed_style_base.py#newcode20 third_party/WebKit/Source/build/scripts/make_computed_style_base.py:20: # We want to sort fields by their ...
3 years, 7 months ago (2017-04-28 00:16:51 UTC) #13
shend
Thanks Bugs. Hi Eddy, can you PTAL? https://codereview.chromium.org/2844223002/diff/20001/third_party/WebKit/Source/build/scripts/make_computed_style_base.py File third_party/WebKit/Source/build/scripts/make_computed_style_base.py (right): https://codereview.chromium.org/2844223002/diff/20001/third_party/WebKit/Source/build/scripts/make_computed_style_base.py#newcode20 third_party/WebKit/Source/build/scripts/make_computed_style_base.py:20: # We ...
3 years, 7 months ago (2017-04-28 01:00:31 UTC) #16
meade_UTC10
lgtm Hey, cool! I have a question though, how will we make sure this list ...
3 years, 7 months ago (2017-04-28 07:51:20 UTC) #21
shend
On 2017/04/28 at 07:51:20, meade wrote: > lgtm > > Hey, cool! I have a ...
3 years, 7 months ago (2017-04-30 22:22:20 UTC) #22
Bugs Nash
On 2017/04/30 at 22:22:20, shend wrote: > On 2017/04/28 at 07:51:20, meade wrote: > > ...
3 years, 7 months ago (2017-04-30 22:56:29 UTC) #23
shend
On 2017/04/30 at 22:56:29, bugsnash wrote: > On 2017/04/30 at 22:22:20, shend wrote: > > ...
3 years, 7 months ago (2017-04-30 23:08:34 UTC) #24
Bugs Nash
On 2017/04/30 at 23:08:34, shend wrote: > On 2017/04/30 at 22:56:29, bugsnash wrote: > > ...
3 years, 7 months ago (2017-04-30 23:27:39 UTC) #25
Bugs Nash
On 2017/04/30 at 23:27:39, Bugs Nash wrote: > On 2017/04/30 at 23:08:34, shend wrote: > ...
3 years, 7 months ago (2017-04-30 23:27:53 UTC) #26
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/2844223002/60001
3 years, 7 months ago (2017-05-01 05:47:14 UTC) #33
commit-bot: I haz the power
3 years, 7 months ago (2017-05-01 05:53:36 UTC) #36
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as
https://chromium.googlesource.com/chromium/src/+/e8abebbc560bc64554c06e0480c2...

Powered by Google App Engine
This is Rietveld 408576698