commit | 42440a3caddee19b4de24cc2947fe827ff468306 | [log] [tgz] |
---|---|---|
author | Anders Hartvoll Ruud <andruud@chromium.org> | Mon Sep 18 21:34:57 2023 |
committer | Chromium LUCI CQ <chromium-scoped@luci-project-accounts.iam.gserviceaccount.com> | Mon Sep 18 21:34:57 2023 |
tree | a76ce7413256f2bcca545378fc09714cba75882d | |
parent | 40b0ce9bcb2a69b9928034cc5753eece82efadaf [diff] |
[StyleBuilder] Create ComputedStyle during TakeStyle() One of the goals of the StyleBuilder project is to allow memory and performance experiments with different ComputedStyle representations, and in particular representations made possible by ComputedStyle being immutable, and created at a single point in time. However, until this CL, ComputedStyleBuilder simply held a ComputedStyle internally for most of its lifetime, and forwarded all builder calls to that object. This CL removes that internal ComputedStyle, and creates it during TakeStyle() instead. The high level explanation of how this works is that ComputedStyleBuilder[Base] now holds all top-level DataRefs plus top-level data directly, and simply copies this over when it's time to create the ComputedStyle. This requires a fair bit of template tweaks, because: - All trivial top-level fields are moved to a struct for performance reasons. - Our single top-level Member (the BaseData field) needs special consideration, and is not part of the struct mentioned above. Since the main objective of this CL is to remove the internal ComputedStyle object, I'd be happy with simply *not* regressing performance. However, we appear to have a small win [1]. This may be because we no longer incur any write barriers for our top-level DataRefs (now RawDataRefs), even when they're Accessed post-initialization. I tried two other approaches: - Dropping the Data struct (each field existing directly on ComputedStyle[Builder]Base). This actually had acceptable performance, though worse than this CL. [2] - Splitting the Data struct into two structs, inherited and non-inherited. This allows more reasonable copying of fields from the inherited and non-inherited sources (in the two-source constructor of ComputedStyleBuilderBase), and performance indeed seemed better [3]. However, it increased the sizeof(ComputedStyle) by eight bytes, so it's better to make that trade-off separately. [1] This CL: 50 trial(s) on each side. Initial style (µs) Before After Perf 95% CI (BCa) =================== ========= ========= ======= ================= ECommerce 5321 5288 +0.6% [ -0.9%, +1.8%] Encyclopedia 53370 53298 +0.1% [ -1.6%, +1.1%] Extension 64645 63514 +1.8% [ +0.4%, +2.6%] News 24231 24166 +0.3% [ -0.5%, +1.0%] Search 7516 7465 +0.7% [ -0.2%, +1.6%] Social1 14101 13966 +1.0% [ +0.3%, +1.7%] Social2 8853 8820 +0.4% [ -0.8%, +1.1%] Sports 28252 28520 -0.9% [ -2.8%, -0.2%] Video 21136 21158 -0.1% [ -3.6%, +1.1%] Geometric mean +0.4% [ -0.3%, +0.9%] Recalc style (µs) Before After Perf 95% CI (BCa) =================== ========= ========= ======= ================= ECommerce 6035 5982 +0.9% [ -1.4%, +2.1%] Encyclopedia 38987 38674 +0.8% [ +0.1%, +1.4%] Extension 58993 57797 +2.1% [ +0.4%, +3.0%] News 22243 22084 +0.7% [ -0.7%, +1.8%] Search 3503 3473 +0.9% [ -0.2%, +1.9%] Social1 9299 9208 +1.0% [ +0.2%, +1.8%] Social2 6804 6746 +0.8% [ -0.9%, +1.9%] Sports 13812 13751 +0.4% [ -0.4%, +1.1%] Video 13491 13278 +1.6% [ +1.1%, +2.1%] Geometric mean +1.0% [ +0.4%, +1.5%] [2] Data-less alternative (not this CL): 50 trial(s) on each side. Initial style (µs) Before After Perf 95% CI (BCa) =================== ========= ========= ======= ================= ECommerce 5303 5357 -1.0% [ -1.9%, -0.1%] Encyclopedia 53719 53972 -0.5% [ -1.6%, +0.4%] Extension 64804 65096 -0.4% [ -2.4%, +0.2%] News 24272 24133 +0.6% [ -1.4%, +1.5%] Search 7499 7557 -0.8% [ -2.0%, +0.6%] Social1 14197 14043 +1.1% [ +0.3%, +2.1%] Social2 8886 8920 -0.4% [ -1.7%, +1.4%] Sports 28965 28633 +1.2% [ -0.8%, +7.2%] Video 21321 21069 +1.2% [ -0.2%, +2.4%] Geometric mean +0.1% [ -0.4%, +0.7%] Recalc style (µs) Before After Perf 95% CI (BCa) =================== ========= ========= ======= ================= ECommerce 6040 6026 +0.2% [ -0.7%, +1.3%] Encyclopedia 39135 39533 -1.0% [ -2.8%, -0.1%] Extension 58895 59412 -0.9% [ -1.7%, -0.4%] News 22102 22006 +0.4% [ -1.5%, +1.4%] Search 3496 3547 -1.5% [ -2.7%, -0.2%] Social1 9289 9269 +0.2% [ -0.9%, +1.3%] Social2 6882 6808 +1.1% [ -0.1%, +2.6%] Sports 14047 14205 -1.1% [ -3.3%, +5.7%] Video 13623 13403 +1.6% [ -2.3%, +3.3%] Geometric mean -0.1% [ -0.6%, +0.4%] [3] Data split into inherited/non-inherited (not this CL): 50 trial(s) on each side. Initial style (µs) Before After Perf 95% CI (BCa) =================== ========= ========= ======= ================= ECommerce 5401 5174 +4.4% [ +3.3%, +7.1%] Encyclopedia 53580 53270 +0.6% [ -1.1%, +1.4%] Extension 65024 62704 +3.7% [ +3.1%, +4.3%] News 24369 24083 +1.2% [ +0.8%, +1.6%] Search 7493 7544 -0.7% [ -2.9%, +0.7%] Social1 14173 14015 +1.1% [ -0.0%, +1.8%] Social2 8877 8770 +1.2% [ -1.2%, +2.4%] Sports 28557 28695 -0.5% [ -2.8%, +1.0%] Video 21280 20974 +1.5% [ +0.8%, +2.1%] Geometric mean +1.4% [ +0.8%, +1.9%] Recalc style (µs) Before After Perf 95% CI (BCa) =================== ========= ========= ======= ================= ECommerce 6074 5867 +3.5% [ +2.6%, +5.3%] Encyclopedia 39240 38507 +1.9% [ +0.3%, +2.7%] Extension 59095 56577 +4.5% [ +4.0%, +5.0%] News 22322 21869 +2.1% [ +1.5%, +2.6%] Search 3538 3450 +2.6% [ +0.8%, +4.5%] Social1 9290 9232 +0.6% [ -1.5%, +1.7%] Social2 6880 6593 +4.3% [ +3.0%, +5.8%] Sports 13897 13879 +0.1% [ -0.6%, +0.9%] Video 13571 13208 +2.7% [ +1.7%, +3.6%] Geometric mean +2.5% [ +2.0%, +2.9%] Change-Id: I241bc64f5b13e3550c37d215592450b17c0bd617 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4869454 Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1198022}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone
! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.