WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
193058
clang-tidy: Save 8 padding bytes on WebCore::BorderEdge
https://bugs.webkit.org/show_bug.cgi?id=193058
Summary
clang-tidy: Save 8 padding bytes on WebCore::BorderEdge
David Kilzer (:ddkilzer)
Reported
2018-12-29 16:53:44 PST
Running `clang-tidy -header-filter=.* -checks='-*,clang-analyzer-optin.performance.*' ...` on WebCore source files found unneeded padding bytes in the WebCore::BorderEdge class. Source/WebCore/rendering/BorderEdge.h:39:7: warning: Excessive padding in 'class WebCore::BorderEdge' (9 padding bytes, where 1 is optimal). Optimal fields order: m_color, m_width, m_flooredToDevicePixelWidth, m_devicePixelRatio, m_style, m_isTransparent, m_isPresent, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding] class BorderEdge { ^
Attachments
Patch v1
(2.65 KB, patch)
2018-12-29 16:58 PST
,
David Kilzer (:ddkilzer)
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
David Kilzer (:ddkilzer)
Comment 1
2018-12-29 16:55:32 PST
$ ./Tools/Scripts/dump-class-layout -c Release -a x86_64 -b $BUILD_DIR WebCore WebCore::BorderEdge +0 < 32> BorderEdge +0 < 4> WebCore::LayoutUnit m_width +0 < 4> int m_value +4 < 4> <PADDING: 4 bytes> +8 < 8> WebCore::Color m_color +8 < 8> WebCore::Color::(anonymous union) m_colorData +16 < 1> WebCore::BorderStyle m_style +17 < 1> bool m_isTransparent +18 < 1> bool m_isPresent +19 < 1> <PADDING: 1 byte> +20 < 4> float m_flooredToDevicePixelWidth +24 < 4> float m_devicePixelRatio +28 < 4> <PADDING: 4 bytes> Total byte size: 32 Total pad bytes: 9 Padding percentage: 28.12 % Removing 8 padding bytes would make the class 24 bytes.
Radar WebKit Bug Importer
Comment 2
2018-12-29 16:56:20 PST
<
rdar://problem/46979275
>
David Kilzer (:ddkilzer)
Comment 3
2018-12-29 16:58:54 PST
Created
attachment 358141
[details]
Patch v1
David Kilzer (:ddkilzer)
Comment 4
2018-12-29 19:24:05 PST
(In reply to David Kilzer (:ddkilzer) from
comment #1
)
> $ ./Tools/Scripts/dump-class-layout -c Release -a x86_64 -b $BUILD_DIR > WebCore WebCore::BorderEdge > +0 < 32> BorderEdge > +0 < 4> WebCore::LayoutUnit m_width > +0 < 4> int m_value > +4 < 4> <PADDING: 4 bytes> > +8 < 8> WebCore::Color m_color > +8 < 8> WebCore::Color::(anonymous union) m_colorData > +16 < 1> WebCore::BorderStyle m_style > +17 < 1> bool m_isTransparent > +18 < 1> bool m_isPresent > +19 < 1> <PADDING: 1 byte> > +20 < 4> float m_flooredToDevicePixelWidth > +24 < 4> float m_devicePixelRatio > +28 < 4> <PADDING: 4 bytes> > Total byte size: 32 > Total pad bytes: 9 > Padding percentage: 28.12 % > > Removing 8 padding bytes would make the class 24 bytes.
After the patch is applied: $ ./Tools/Scripts/dump-class-layout -c Release -a x86_64 -b $BUILD_DIR WebCore WebCore::BorderEdge +0 < 24> BorderEdge +0 < 8> WebCore::Color m_color +0 < 8> WebCore::Color::(anonymous union) m_colorData +8 < 4> WebCore::LayoutUnit m_width +8 < 4> int m_value +12 < 4> float m_flooredToDevicePixelWidth +16 < 4> float m_devicePixelRatio +20 < 1> WebCore::BorderStyle m_style +21 < 1> bool m_isTransparent +22 < 1> bool m_isPresent +23 < 1> <PADDING: 1 byte> Total byte size: 24 Total pad bytes: 1 Padding percentage: 4.17 %
Yusuke Suzuki
Comment 5
2018-12-30 13:30:17 PST
Comment on
attachment 358141
[details]
Patch v1 r=me, nice.
WebKit Commit Bot
Comment 6
2018-12-30 13:56:58 PST
Comment on
attachment 358141
[details]
Patch v1 Clearing flags on attachment: 358141 Committed
r239563
: <
https://trac.webkit.org/changeset/239563
>
WebKit Commit Bot
Comment 7
2018-12-30 13:56:59 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug