Skip to content

layout: Skip layout traversals that obviously won't do anything. - #10021

Merged
bors-servo merged 6 commits into
servo:masterfrom
pcwalton:skip-layout-traversals
Mar 21, 2016
Merged

bors-servo merged 6 commits into
servo:masterfrom
pcwalton:skip-layout-traversals

Conversation

@pcwalton

Copy link
Copy Markdown
Contributor

This reduces CPU usage when mousing over simple pages (example.com). More complex pages (Wikipedia) still reflow a lot due to other bugs.

Additionally, this change causes Servo to stop painting the results of hit test queries. This is also a win for CPU usage.

This significantly improves #9999, though there's more that can be done. I'll leave it open in case @paulrouget thinks this PR isn't enough.

r? @mbrubeck


This change is Reviewable

@highfive

Copy link
Copy Markdown

warning Warning warning

  • These commits modify layout and script code, but no tests are modified. Please consider adding a test!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Mar 15, 2016
Comment thread components/layout/layout_thread.rs Outdated
let display_list = if flow::base(&**layout_root).restyle_damage
.contains(REPAINT) ||
rw_data.display_list.is_none() {
println!("rebuilding display list");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Probably debug! is wanted here.

@mbrubeck

Copy link
Copy Markdown
Contributor

-S-awaiting-review +S-needs-code-changes


Reviewed 3 of 3 files at r1.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


components/layout/layout_thread.rs, line 873 [r1] (raw file):
With this change, I got a layout thread panic at 'Tried to hit test with no display list' when mousing over the window before a page loaded.

Maybe if there is no display list, we should build it unconditionally?


Comments from the review on Reviewable.io

@mbrubeck mbrubeck added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Mar 16, 2016
@pcwalton
pcwalton force-pushed the skip-layout-traversals branch from 01ca115 to 3455b4a Compare March 16, 2016 04:29
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Mar 16, 2016
@pcwalton

Copy link
Copy Markdown
Contributor Author

Addressed review comments. r? @mbrubeck

@@ -236,6 +236,6 @@ impl<'a> BuildDisplayList<'a> {

#[inline]
fn should_process(&self) -> bool {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove?

@paulrouget

Copy link
Copy Markdown
Contributor

I think this is breaking browserhtml.

The progressbar is not redrawn.

@paulrouget

Copy link
Copy Markdown
Contributor

Also - PNG images show up late (the window controls in browserhtml).

@paulrouget

Copy link
Copy Markdown
Contributor

Would a test case help?

@pcwalton

Copy link
Copy Markdown
Contributor Author

Yeah, a test case would be useful. This sounds like another case in which we didn't reflow properly in script and counted on the hit test reflow to draw.

@mbrubeck

Copy link
Copy Markdown
Contributor

Reviewed 2 of 2 files at r2.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


Comments from the review on Reviewable.io

@mbrubeck

Copy link
Copy Markdown
Contributor

PNG images show up late (the window controls in browserhtml).

I think this is because an image load increments the pending_reflow_count, but then a hit test test will cause a call to Window::force_reflow which resets the counter (cancels the pending reflow). This is now incorrect because the forced reflow does not repaint, while the pending reflow would have.

@pcwalton
pcwalton force-pushed the skip-layout-traversals branch from 3455b4a to df27547 Compare March 16, 2016 21:54
@pcwalton

Copy link
Copy Markdown
Contributor Author

Fixed both bugs.

r? @mbrubeck

@mbrubeck

Copy link
Copy Markdown
Contributor

@bors-servo r+


Reviewed 2 of 2 files at r3.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


Comments from the review on Reviewable.io

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit df27547 has been approved by mbrubeck

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Mar 16, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit df27547 with merge 4f5999c...

bors-servo pushed a commit that referenced this pull request Mar 16, 2016
layout: Skip layout traversals that obviously won't do anything.

This reduces CPU usage when mousing over simple pages (example.com). More complex pages (Wikipedia) still reflow a lot due to other bugs.

Additionally, this change causes Servo to stop painting the results of hit test queries. This is also a win for CPU usage.

This significantly improves #9999, though there's more that can be done. I'll leave it open in case @paulrouget thinks this PR isn't enough.

r? @mbrubeck

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10021)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - mac-rel-wpt

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Mar 16, 2016
@mbrubeck

Copy link
Copy Markdown
Contributor

There are unexpected results in both test-css and test-wpt, and they are consistent across Linux and Mac:

  ▶ PASS [expected FAIL] /css-transforms-1_dev/html/perspective-translateZ-negative.htm

  ▶ FAIL [expected PASS] /css21_dev/html4/z-index-dynamic-001.htm
  └   → /css21_dev/html4/z-index-dynamic-001.htm 7d53c98773aae0945c22d7e5bbe05999f7ccd0c7
/css21_dev/html4/reference/ref-filled-green-100px-square.htm 82d94d2027e216f7a2d31fcc53afb5e048516cef
Testing 7d53c98773aae0945c22d7e5bbe05999f7ccd0c7 == 82d94d2027e216f7a2d31fcc53afb5e048516cef

  ▶ FAIL [expected PASS] /_mozilla/css/list_item_overflow.html
  └   → /_mozilla/css/list_item_overflow.html 916b152431c176d3c9b28afb86be616d6168f646
/_mozilla/css/list_item_overflow_ref.html a8fc81d3fc0f23056c2e6a616cba6e4e684a823f
Testing 916b152431c176d3c9b28afb86be616d6168f646 == a8fc81d3fc0f23056c2e6a616cba6e4e684a823f

  ▶ FAIL [expected PASS] /_mozilla/css/position_fixed_overflow_a.html
  └   → /_mozilla/css/position_fixed_overflow_a.html 6f87cc04be15cb35de8a96f996443204a0ea75bf
/_mozilla/css/position_fixed_overflow_b.html 53765186b05853a4705eded01c26237bd847a93c
Testing 6f87cc04be15cb35de8a96f996443204a0ea75bf == 53765186b05853a4705eded01c26237bd847a93c

@highfive highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Mar 21, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 7a131ba with merge e31d475...

bors-servo pushed a commit that referenced this pull request Mar 21, 2016
layout: Skip layout traversals that obviously won't do anything.

This reduces CPU usage when mousing over simple pages (example.com). More complex pages (Wikipedia) still reflow a lot due to other bugs.

Additionally, this change causes Servo to stop painting the results of hit test queries. This is also a win for CPU usage.

This significantly improves #9999, though there's more that can be done. I'll leave it open in case @paulrouget thinks this PR isn't enough.

r? @mbrubeck

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10021)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - android

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Mar 21, 2016
@pcwalton

Copy link
Copy Markdown
Contributor Author

@larsbergstrom Do you have an idea as to what might be going on with

@pcwalton pcwalton closed this Mar 21, 2016
@pcwalton pcwalton reopened this Mar 21, 2016
@pcwalton

Copy link
Copy Markdown
Contributor Author

@larsbergstrom ...that failure?

@mbrubeck

Copy link
Copy Markdown
Contributor

It's failing to find arm-linux-androideabi-gcc. Looks like a configuration problem on the "servo-linux-cross1" build machine.

@larsbergstrom

Copy link
Copy Markdown
Contributor

@pcwalton Sorry, we are doing upgrades to the infra. I should have turned off r+ privs entirely instead of just posting on #servo - will do in the future! I'll retry once the machines are online.

@edunham

edunham commented Mar 21, 2016

Copy link
Copy Markdown
Contributor

@bors-servo retry

My bad on the earlier fail; I added a slave to Buildbot before double checking that it could complete a test successfully

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 7a131ba with merge 9b438ee...

bors-servo pushed a commit that referenced this pull request Mar 21, 2016
layout: Skip layout traversals that obviously won't do anything.

This reduces CPU usage when mousing over simple pages (example.com). More complex pages (Wikipedia) still reflow a lot due to other bugs.

Additionally, this change causes Servo to stop painting the results of hit test queries. This is also a win for CPU usage.

This significantly improves #9999, though there's more that can be done. I'll leave it open in case @paulrouget thinks this PR isn't enough.

r? @mbrubeck

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10021)
<!-- Reviewable:end -->
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Mar 21, 2016
@edunham

edunham commented Mar 21, 2016

Copy link
Copy Markdown
Contributor

@bors-servo retry

@edunham

edunham commented Mar 21, 2016

Copy link
Copy Markdown
Contributor

Buildbot may fail here due to variable expansion failure fixed in servo/saltfs#261 .

@bors-servo

Copy link
Copy Markdown
Contributor

💣 Failed to start rebuilding: Unknown error

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 7a131ba with merge 9813d11...

bors-servo pushed a commit that referenced this pull request Mar 21, 2016
layout: Skip layout traversals that obviously won't do anything.

This reduces CPU usage when mousing over simple pages (example.com). More complex pages (Wikipedia) still reflow a lot due to other bugs.

Additionally, this change causes Servo to stop painting the results of hit test queries. This is also a win for CPU usage.

This significantly improves #9999, though there's more that can be done. I'll leave it open in case @paulrouget thinks this PR isn't enough.

r? @mbrubeck

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10021)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, status-appveyor

@bors-servo
bors-servo merged commit 7a131ba into servo:master Mar 21, 2016
This was referenced Mar 21, 2016
mbrubeck added a commit to mbrubeck/servo that referenced this pull request Mar 25, 2016
After servo#10021, `LayoutThread::repaint` no longer forced a repaint because of
the `restyle_damage` check.  This patch adds the correct restyle damage and
fixes servo#10163.
bors-servo pushed a commit that referenced this pull request Mar 25, 2016
Fix forced repaint on image load

After #10021, `LayoutThread::repaint` no longer forced a repaint because of the `restyle_damage` check.  This patch adds the correct restyle damage and fixes #10163.

r? @pcwalton

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10197)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.