Bug 311452
| Summary: | Build Time Improvement: Move variant-heavy inline functions from CalcTree headers to .cpp files | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Brent Fulgham <bfulgham> |
| Component: | New Bugs | Assignee: | Brent Fulgham <bfulgham> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | sam, simon.fraser, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Brent Fulgham
The CSSCalc::Node (38-type variant) and Style::Calculation::Node (33-type variant) trigger expensive mpark::variant template instantiations (constructor, destructor, move_constructor, switchOn dispatch) in every translation unit that includes their headers.
This patch moves convenience functions that create, move, or switchOn these variant types from inline definitions in headers to their corresponding .cpp files. This avoids unnecessary variant template instantiation in files that include the headers but don't call these functions.
(1) CSSCalcTree.h => CSSCalcTree.cpp:
* isNumeric() (switchOn over 38-type variant)add(), multiply(), subtract()
* makeChildWithValueBasedOn() (4 overloads)
(2) StyleCalculationTree.h => StyleCalculationTree.cpp:
* number(), percentage(), dimension()
* add(), multiply(), subtract(), blend()
Note: Trivial move constructors/operators (Children, ChildOrNone) were left inline to avoid runtime overhead on hot paths.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Brent Fulgham
Build data from -ftrace-time comparing builds:
1. -21.13s (21.26s -> 0.12s, -99.4%) [221 -> 1 TUs] WebCore::CSSCalc::Child::switchOn<(lambda ...
2. -21.01s (21.13s -> 0.12s, -99.4%) [221 -> 1 TUs] WTF::visitOneVariant<0UL, WTF::Visitor<(lambda ...
3. -4.60s (4.64s -> 0.03s, -99.3%) [221 -> 1 TUs] WTF::visitOneVariant<32UL, WTF::Visitor<(lambda ...
4. -2.90s (2.90s -> 0.00s, -100.0%) [200 -> 0 TUs] WebCore::CSSCalc::Child::switchOn<(lambda ...
5. -2.84s (2.84s -> 0.00s, -100.0%) [200 -> 0 TUs] WTF::visitOneVariant<0UL, WTF::Visitor<(lambda ...
6. -1.46s (1.46s -> 0.00s, -99.7%) [229 -> 1 TUs] WebCore::Style::Calculation::makeChild<WebCore::Style::Calculation::Blend>
7. -1.41s (1.42s -> 0.00s, -99.7%) [229 -> 1 TUs] WebCore::Style::Calculation::ChildConstruction<WebCore::Style::Calculation::Blend>::make
8. -1.15s (1.15s -> 0.00s, -99.6%) [221 -> 1 TUs] WebCore::CSSCalc::makeChild<WebCore::CSSCalc::Negate>
9. -1.11s (1.11s -> 0.00s, -99.6%) [221 -> 1 TUs] WebCore::CSSCalc::ChildConstruction<WebCore::CSSCalc::Negate>::make
10. -0.99s (0.99s -> 0.00s, -99.6%) [229 -> 1 TUs] WebCore::Style::Calculation::makeChild<WebCore::Style::Calculation::Negate>
Radar WebKit Bug Importer
<rdar://problem/174049948>
Brent Fulgham
Pull request: https://github.com/WebKit/WebKit/pull/62009
EWS
Committed 310727@main (0bd48dfc0abc): <https://commits.webkit.org/310727@main>
Reviewed commits have been landed. Closing PR #62009 and removing active labels.