Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added dom obj counting to decide sequential/parallel layout (#10110) #12862

Merged
merged 2 commits into from Dec 7, 2016

Conversation

@notriddle
Copy link
Contributor

notriddle commented Aug 14, 2016

This is a rebased version of #11713


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #10110 (github issue number if applicable).
  • There are no tests for these changes because it's an optimization with no visible behavioral changes

This change is Reviewable

@highfive
Copy link

highfive commented Aug 14, 2016

Heads up! This PR modifies the following files:

  • @KiChjang: components/script/dom/document.rs, components/script/parse/html.rs, components/script/dom/servohtmlparser.rs, components/script_layout_interface/message.rs, components/script/dom/window.rs
@highfive
Copy link

highfive commented Aug 14, 2016

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!
@emilio
Copy link
Member

emilio commented Aug 14, 2016

This was already reviewed in the original PR, so r=me,metajack I guess, though I think a check with browserhtml would be nice, to see if we parallelize in those cases.

@metajack what do you think about the following comments (excluding nits).

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


Reviewed 6 of 6 files at r1.
Review status: all files reviewed at latest revision, 8 unresolved discussions, some commit checks failed.


components/layout_thread/lib.rs, line 403 [r1] (raw file):

                                    thread_state::LAYOUT,
                                    layout_threads);

nit: extra newline.


components/layout_thread/lib.rs, line 741 [r1] (raw file):

        // ... as do each of the LayoutWorkers, if present.
        let ref traversal = self.parallel_traversal;

maybe merge these two lines? self.parallel_traversal.heap_size_of_tls()


components/layout_thread/lib.rs, line 802 [r1] (raw file):

    /// crash.
    fn exit_now(&mut self) {
        let ref mut traversal = self.parallel_traversal;

nit: self.parallel_traversal.shutdown()?


components/layout_thread/lib.rs, line 1458 [r1] (raw file):

                    let profiler_metadata = self.profiler_metadata();

                    debug!("layout: post style parallel? {}", self.parallel_flag);

Is this really needed?


components/script/dom/document.rs, line 415 [r1] (raw file):

    pub fn increment_dom_count(&self) {
        self.dom_count.set(self.dom_count.get() + 1);

Also, can you file a followup to update this when nodes are removed or inserted dynamically? Right now it seems to me that dom_count is something like dom_elements_at_first_page_parse, and it doesn't seem really nice not taking into account elements dinamically created. In fact, I doubt this will even turn parallel layout on for bhtml, for example, whose index.html page is almost empty.


components/script/dom/servohtmlparser.rs, line 284 [r1] (raw file):

        };

nit: extra newline.


components/script/dom/servohtmlparser.rs, line 342 [r1] (raw file):

        &self.pending_input
    }

nit: So is this, and you can probably take rid of the other below.


components/script/parse/html.rs, line 94 [r1] (raw file):

        }

        self.document.increment_dom_count();

Should this also go in insert()? where text nodes are created?


Comments from Reviewable

@notriddle
Copy link
Contributor Author

notriddle commented Aug 15, 2016

components/layout_thread/lib.rs, line 403 [r1] (raw file):

Previously, emilio (Emilio Cobos Álvarez) wrote…

nit: extra newline.

Done.

Comments from Reviewable

@notriddle
Copy link
Contributor Author

notriddle commented Aug 15, 2016

components/layout_thread/lib.rs, line 741 [r1] (raw file):

Previously, emilio (Emilio Cobos Álvarez) wrote…

maybe merge these two lines? self.parallel_traversal.heap_size_of_tls()

Done.

Comments from Reviewable

@notriddle
Copy link
Contributor Author

notriddle commented Aug 15, 2016

components/layout_thread/lib.rs, line 802 [r1] (raw file):

Previously, emilio (Emilio Cobos Álvarez) wrote…

nit: self.parallel_traversal.shutdown()?

Done.

Comments from Reviewable

@notriddle
Copy link
Contributor Author

notriddle commented Aug 15, 2016

components/layout_thread/lib.rs, line 1458 [r1] (raw file):

Previously, emilio (Emilio Cobos Álvarez) wrote…

Is this really needed?

Done.

Comments from Reviewable

@notriddle
Copy link
Contributor Author

notriddle commented Aug 15, 2016

components/script/dom/servohtmlparser.rs, line 342 [r1] (raw file):

Previously, emilio (Emilio Cobos Álvarez) wrote…

nit: So is this, and you can probably take rid of the other below.

Done.

Comments from Reviewable

@notriddle
Copy link
Contributor Author

notriddle commented Aug 15, 2016

components/script/dom/servohtmlparser.rs, line 284 [r1] (raw file):

Previously, emilio (Emilio Cobos Álvarez) wrote…

nit: extra newline.

Done.

Comments from Reviewable

@notriddle
Copy link
Contributor Author

notriddle commented Aug 15, 2016

components/script/parse/html.rs, line 94 [r1] (raw file):

Previously, emilio (Emilio Cobos Álvarez) wrote…

Should this also go in insert()? where text nodes are created?

Text nodes can't be laid out in parallel, so a page with a bunch of text nodes but very little structure probably wouldn't benefit from parallel layout.

Comments from Reviewable

@emilio
Copy link
Member

emilio commented Aug 15, 2016

Reviewed 1 of 1 files at r2, 1 of 1 files at r3.
Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


components/script/parse/html.rs, line 94 [r1] (raw file):

Previously, notriddle (Michael Howell) wrote…

Text nodes can't be laid out in parallel, so a page with a bunch of text nodes but very little structure probably wouldn't benefit from parallel layout.

They can be styled in parallel though, and styling is a decent amount of the whole layout process.

Comments from Reviewable

@notriddle
Copy link
Contributor Author

notriddle commented Aug 15, 2016

components/script/dom/document.rs, line 415 [r1] (raw file):

Previously, emilio (Emilio Cobos Álvarez) wrote…

Also, can you file a followup to update this when nodes are removed or inserted dynamically? Right now it seems to me that dom_count is something like dom_elements_at_first_page_parse, and it doesn't seem really nice not taking into account elements dinamically created. In fact, I doubt this will even turn parallel layout on for bhtml, for example, whose index.html page is almost empty.

Done. #12871

Comments from Reviewable

@notriddle notriddle force-pushed the layout-new branch from b59e7fd to 59a2269 Aug 15, 2016
@notriddle
Copy link
Contributor Author

notriddle commented Aug 15, 2016

Review status: 4 of 6 files reviewed at latest revision, 2 unresolved discussions.


components/script/parse/html.rs, line 94 [r1] (raw file):

Previously, emilio (Emilio Cobos Álvarez) wrote…

They can be styled in parallel though, and styling is a decent amount of the whole layout process.

Done.

Comments from Reviewable

@nox
Copy link
Member

nox commented Aug 15, 2016

I think the counting should be a new weight field on Node and be updated on every DOM mutation. We already need to notify all ancestors on mutations that something in the tree changed, and I have a few ideas to use that weight as an optimisation. For example we know for sure that a node with a lesser weight than an other node cannot be one of its ancestors.

@notriddle notriddle force-pushed the layout-new branch from 59a2269 to bb1b1db Aug 15, 2016
@notriddle
Copy link
Contributor Author

notriddle commented Aug 16, 2016

In this PR, or a follow-up?


Comments from Reviewable

@nox
Copy link
Member

nox commented Aug 16, 2016

@notriddle Yeah not blocking this.

@nox nox assigned emilio and unassigned nox Aug 16, 2016
@emilio
Copy link
Member

emilio commented Aug 16, 2016

r=me if you think testing with bhtml is not necessary, or if you have done it and it parallelizes/it's not a severe perf impact.

@notriddle notriddle force-pushed the layout-new branch 2 times, most recently from 48b58ae to a0de902 Aug 17, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Dec 5, 2016

💔 Test failed - linux-rel-wpt

@highfive highfive removed the S-tests-failed label Dec 6, 2016
@notriddle
Copy link
Contributor Author

notriddle commented Dec 6, 2016

Let's see if that fixed it.

@notriddle
Copy link
Contributor Author

notriddle commented Dec 6, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Dec 6, 2016

Trying commit f8121ae with merge 6c9c14d...

bors-servo added a commit that referenced this pull request Dec 6, 2016
added dom obj counting to decide sequential/parallel layout (#10110)

This is a rebased version of #11713

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #10110 (github issue number if applicable).
- [X] There are no tests for these changes because it's an optimization with no visible behavioral changes

<!-- Reviewable:start -->

---

This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12862)

<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Dec 6, 2016

💔 Test failed - linux-rel-css

@notriddle
Copy link
Contributor Author

notriddle commented Dec 6, 2016

I've finally managed to pass all the DOM tests. That fixed 'em.

  ▶ FAIL [expected PASS] /css21_dev/html4/abs-pos-non-replaced-vlr-149.htm
  └   → /css21_dev/html4/abs-pos-non-replaced-vlr-149.htm 495c94c5bdb9351da4864d1dffcb6741003f6a42
/css21_dev/html4/reference/abs-pos-non-replaced-vlr-009-ref.htm 760d37f04422ccc35f8b05dda55d0a8c5e6b2a3b
Testing 495c94c5bdb9351da4864d1dffcb6741003f6a42 == 760d37f04422ccc35f8b05dda55d0a8c5e6b2a3b

  ▶ Unexpected subtest result in /css-transitions-1_dev/html/changing-while-transition.htm:
  └ PASS [expected FAIL] changing transition-property / values

Now for more slogging through reftests that fail in sequential mode.

Copy link
Member

emilio left a comment

Those are known intermittents:

r=me if tests pass and with the comment below addressed if you feel it's necessary :)

@@ -71,9 +71,12 @@ impl VirtualMethods for HTMLTitleElement {
}
}

fn bind_to_tree(&self, is_in_doc: bool) {
fn bind_to_tree(&self, tree_in_doc: bool) {
if let Some(ref s) = self.super_type() {

This comment has been minimized.

Copy link
@emilio

emilio Dec 7, 2016

Member

You can unwrap here, right? Also above.

@emilio
Copy link
Member

emilio commented Dec 7, 2016

@KiChjang
Copy link
Member

KiChjang commented Dec 7, 2016

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Dec 7, 2016

Trying commit f8121ae with merge 983a1f8...

bors-servo added a commit that referenced this pull request Dec 7, 2016
added dom obj counting to decide sequential/parallel layout (#10110)

This is a rebased version of #11713

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #10110 (github issue number if applicable).
- [X] There are no tests for these changes because it's an optimization with no visible behavioral changes

<!-- Reviewable:start -->

---

This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12862)

<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Dec 7, 2016

@KiChjang KiChjang removed the S-needs-rebase label Dec 7, 2016
@notriddle
Copy link
Contributor Author

notriddle commented Dec 7, 2016

That's not what the vast majority of the existing ones do.

@bors-servo r=emilio

@bors-servo
Copy link
Contributor

bors-servo commented Dec 7, 2016

📌 Commit f8121ae has been approved by emilio

@notriddle
Copy link
Contributor Author

notriddle commented Dec 7, 2016

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Dec 7, 2016

Testing commit f8121ae with merge 0fe94a6...

bors-servo added a commit that referenced this pull request Dec 7, 2016
added dom obj counting to decide sequential/parallel layout (#10110)

This is a rebased version of #11713

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #10110 (github issue number if applicable).
- [X] There are no tests for these changes because it's an optimization with no visible behavioral changes

<!-- Reviewable:start -->

---

This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12862)

<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Dec 7, 2016

@bors-servo bors-servo merged commit f8121ae into master Dec 7, 2016
4 checks passed
4 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
dependency-ci Dependencies checked
Details
homu Test successful
Details
@notriddle notriddle deleted the layout-new branch Dec 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

9 participants
You can’t perform that action at this time.