DescriptionExpanding Type Traits to make Vector use mem ops more.
Vector has several code paths depending on whether the encapsulated
object can be handled with memmove/memcpu/memset or not, and those
are used by many objects. Unfortunately that requires manual hinting
in each class because the type traits used are not strong enough.
By using type trait functions available in all modern compilers it's
possible to more intelligently select the most optimal code path.
Preferably the code would use the new type traits in C++ 11 but
unfortunately that requires a modern c++ library. Luckily, those
libraries are mostly just thin wrappers on top of de facto-standard
compiler extension functions anyway.
With clang this cuts away 105 KB of machine code in blink. Mostly by
no longer needing copy constructor and assignment operators in many
classes so those can be stripped from the binary.
With gcc the changes are differently. The binary is smaller but only
by 5 KB. It's clear that many Vector methods have become more compact but
it seems gcc compensated by spending that space elsewhere (more inlining?).
I don't have as good measurement tools for Visual Studio but there was no
huge difference in footprint.
Performance, all this is from a noisy development computer with a
non-stable cpu clock frequency (turbo ftl...):
In LayoutTests most changes are within noise levels. But it looks like
large tables and flexboxes might be 1-5% faster. In ParserTests
html5-full-render (macro-benchmark) became 2-3% faster.
clang footprint numbers:
Total change: -109940 bytes
===========================
14 added, totalling +3397 bytes across 8 sources
19 removed, totalling -13302 bytes across 6 sources
8 grown, for a net change of +578 bytes (2268 bytes before, 2846 bytes after) across 6 sources
230 shrunk, for a net change of -100613 bytes (190909 bytes before, 90296 bytes after) across 49 sources
Biggest changes:
-84410 - Source: /home/bratell/src/chromium/src/third_party/WebKit/Source/wtf/Vector.h - (gained 784, lost 85194)
-6934 - Source: /home/bratell/src/chromium/src/third_party/WebKit/Source/wtf/Deque.h - (gained 0, lost 6934)
-2267 - Source: /home/bratell/src/chromium/src/third_party/WebKit/Source/core/animation/css/CSSAnimationData.cpp - (gained 904, lost 3171)
...
+245 - Source: /home/bratell/src/chromium/src/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp - (gained 245, lost 0)
BUG=
R=jochen@chromium.org
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=182427
Patch Set 1 #Patch Set 2 : Compile fixes #Patch Set 3 : #Patch Set 4 : More efficient Vector with more type traits. #
Messages
Total messages: 17 (8 generated)
|