New issue
Advanced search Search tips

Issue 875147 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Task


Participants' hotlists:
layoutng


Sign in to add a comment

[LayoutNG] cs.chromium.org is painfully slow

Project Member Reported by kojii@chromium.org, Aug 17

Issue description

This is the only page I use daily but often prefer not to dogfood because it's too slow atm, filing to share information and track progress.

Example URL:
https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/layout/layout_object.h

It looks like we spent most of our time in:
  LayoutFlexibleBox::UpdateBlockLayout
  LayoutFlexibleBox::LayoutFlexItems
  ...
  HandleInFlow

Not sure if we call HandleInFlow too many times, or some parts of HandleInFlow is slow for some reasons yet.

I originally thought we re-shape a lot because of syntax highlighting and auto-linkify, but shaping seems to be very fast in this case.

% export CPUPROFILE_FREQUENCY=1000
% $OUT/chrome --enable-blink-features=LayoutNG --enable-profiling --profiling-at-start=renderer --no-sandbox https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/layout/layout_object.h

 
cs.chromium.org-0817.svg
185 KB Download
Sounds a bit like the flexbox-with-stretch-layout.html perf test I've been trying to make faster... though with little success so far.
Project Member

Comment 2 by bugdroid1@chromium.org, Aug 27

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/229c8737a637b6d9b82e6fc2748c5574a16b27f1

commit 229c8737a637b6d9b82e6fc2748c5574a16b27f1
Author: Christian Biesinger <cbiesinger@chromium.org>
Date: Mon Aug 27 18:18:31 2018

[layoutng] Restore a legacy layout optimization

When we do have percentage descendants, we need to force an extra
layout when applying stretch alignment, because the flexbox height
is now definite (per https://drafts.csswg.org/css-flexbox/#algo-stretch)

LayoutNG never set the "has percentage descendants" flag, so we could
not skip this extra layout when there are none. We instead had a
different optimization that addresses the case where the height was
already definite.

This patch makes it so that NG does set the flag and makes flexbox
use this optimization in NG as well. This has the nice side effect
of fixing two tests, in addition to the performance improvement,
because we now correctly handle the case of legacy flexbox ->
legacy flexbox -> NG block -> NG percentage sized, where the
outer flexbox now knows it needs to redo layout in this case (see
 crbug.com/876459  for more details)

Performance improvements according to
https://pinpoint-dot-chromeperf.appspot.com/job/15b736ee640000:
flexbox-lots-of-data          +43.9%
flexbox-with-stretch-layout  +851.2%

Bug: 875147, 876459 

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I535f0c62993f4cdc03f15cdf91efe300989e43b2
Reviewed-on: https://chromium-review.googlesource.com/1190246
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Emil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#586318}
[modify] https://crrev.com/229c8737a637b6d9b82e6fc2748c5574a16b27f1/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
[modify] https://crrev.com/229c8737a637b6d9b82e6fc2748c5574a16b27f1/third_party/blink/renderer/core/layout/layout_flexible_box.cc
[modify] https://crrev.com/229c8737a637b6d9b82e6fc2748c5574a16b27f1/third_party/blink/renderer/core/layout/layout_flexible_box.h
[modify] https://crrev.com/229c8737a637b6d9b82e6fc2748c5574a16b27f1/third_party/blink/renderer/core/layout/ng/ng_length_utils.cc

Sign in to add a comment