[LayoutNG] Inline fragment traversal is slow |
||||||||
Issue descriptionWhen loading the single-page HTML5 spec 50% of the layout time (and over 12% of all time_ is spent in NGPhysicalFragmentCollectorBase::VisitChildren. Allocation only accounts for a small fraction of that. (see center of lower part of attached profile)
,
Aug 13
More importantly, we really shouldn't have to traverse the inlines at all to determine the layer position (UpdateLayerPositions) given that fragments have resolved physical coordinates.
,
Aug 16
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/ad3078c836910d696c0e783e65b9245804f4d043 commit ad3078c836910d696c0e783e65b9245804f4d043 Author: Xiaocheng Hu <xiaochengh@chromium.org> Date: Thu Aug 16 02:08:15 2018 [LayoutNG] Avoid inline fragment traversal on self-painting inlines NGInlineFragmentTraversal::SelfFragmentsOf() traverses the entire inline formatting context's fragment tree to find fragments of a certain layout object, which is basically unnecessary since we can locate the paint fragments directly. The only exception is culled inline, where the layout object doesn't have its own fragments, in which case we still need to traverse the fragment tree. As performance optimization, this patch changes SelfFragmentsOf() to find paint fragments directly, unless the given layout object can be a culled inline. With this patch, the time spent on SelfFragmentsOf() when rendering the single-page HTML5 spec becomes negligible. Bug: 873798 Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng Change-Id: Id4a9e5a8a8e416e9757916e5ae9cf589c4660688 Reviewed-on: https://chromium-review.googlesource.com/1173725 Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org> Reviewed-by: Emil A Eklund <eae@chromium.org> Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Reviewed-by: Koji Ishii <kojii@chromium.org> Cr-Commit-Position: refs/heads/master@{#583499} [modify] https://crrev.com/ad3078c836910d696c0e783e65b9245804f4d043/third_party/blink/renderer/core/layout/ng/inline/ng_inline_fragment_traversal.cc [modify] https://crrev.com/ad3078c836910d696c0e783e65b9245804f4d043/third_party/blink/renderer/core/layout/ng/inline/ng_inline_fragment_traversal.h
,
Aug 16
,
Aug 21
Thank you Xiaocheng! Down to 10% of the total layout time now (from 50%), the remaining time all seem to be coming from NGOutlineUtils::CollectDecendandOutlines.
,
Aug 21
Reassigned to atotic@ as per #5...
,
Aug 22
,
Sep 17
NGOutlineUtils::CollectDecendandOutlines has been deleted, and should no longer cause performance problems.
,
Sep 17
\o/ |
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by e...@chromium.org
, Aug 13