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) #11713

Closed
wants to merge 2 commits into from

Conversation

@avadacatavra
Copy link
Contributor

avadacatavra commented Jun 10, 2016

Added dom count to documents to track number of objects in dom. Changed layout_thread to always create the thread pool, then check to see if it should be parallel/or sequential when it's used.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix part of #10110 (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because @metajack and I aren't sure how to

This change is Reviewable

@highfive
Copy link

highfive commented Jun 10, 2016

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @Ms2ger (or someone else) soon.

@highfive
Copy link

highfive commented Jun 10, 2016

Heads up! This PR modifies the following files:

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

highfive commented Jun 10, 2016

warning Warning warning

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

metajack commented Jun 10, 2016

One small omission (-y 1 has changed semantics with this patch and shouldn't) and the rest are nits. r=me with those fixes.

Previously, highfive wrote…

warning Warning warning

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

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


components/layout/layout_thread.rs, line 790 [r1] (raw file):

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

Don't add extra space after =. One space only.


components/layout/layout_thread.rs, line 1009 [r1] (raw file):

        let document = document.as_document().unwrap();

        self.parallel_flag = data.dom_count > 600;

This needs to take the layout threads count into consideration. We don't want a parallel traversal on a thread pool with 1 thread in it, we want the single threaded traversal.

Maybe self.parallel_flag = opts::get().layout_threads > 1 && data.dom_count > 600?

Also, where does 600 come from? @rzambre's suggestion was 750 based on his data. This probably needs a comment documenting where this value came from as well. A link to the bug is sufficient.


components/layout/layout_thread.rs, line 1136 [r1] (raw file):

                    || {
                // Perform CSS selector matching and flow construction.
                match self.parallel_flag {

Please turn this into a normal if now that's it's a boolean and not an Option.


components/layout/layout_thread.rs, line 1138 [r1] (raw file):

                match self.parallel_flag {
                    false => {
                        //Sequential mode

Space after // and ///. Does tidy not catch that?


components/layout/layout_thread.rs, line 1144 [r1] (raw file):

                    true => {
                        //Parallel mode
                        let ref mut traversal = self.parallel_traversal;

No need for let here. Just pass &mut self.parallel_traversal directly below.


components/layout/layout_thread.rs, line 1403 [r1] (raw file):

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

Normal if please.


components/layout/layout_thread.rs, line 1410 [r1] (raw file):

                        true => {
                            // Parallel mode.
                            let ref mut traversal = self.parallel_traversal;

As above, skip the let binding and just pass &mut self.parallel_traversal directly.


components/layout/layout_thread.rs, line 1418 [r1] (raw file):

                        }
                    }

Please don't add new blank lines unless near code you changed.


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

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

Spaces around +.


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

        };

Don't add blank lines here. There are no non-whitespace changes in this file, so just revert these two blank line additions.


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

}

Spurious blank line.


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

    type Handle = JS<Node>;

Ditto.


Comments from Reviewable

@jdm jdm assigned metajack and unassigned Ms2ger Jun 10, 2016
@avadacatavra avadacatavra force-pushed the avadacatavra:layout-new branch from 18bc37a to 4c3e1f4 Jun 10, 2016
@highfive
Copy link

highfive commented Jun 10, 2016

New code was committed to pull request.

@avadacatavra
Copy link
Contributor Author

avadacatavra commented Jun 10, 2016

@avadacatavra avadacatavra force-pushed the avadacatavra:layout-new branch from 4c3e1f4 to e2a22a8 Jun 10, 2016
@highfive
Copy link

highfive commented Jun 10, 2016

New code was committed to pull request.

@avadacatavra avadacatavra force-pushed the avadacatavra:layout-new branch from e2a22a8 to 1e6bc65 Jun 10, 2016
@highfive
Copy link

highfive commented Jun 10, 2016

New code was committed to pull request.

@metajack
Copy link
Contributor

metajack commented Jun 10, 2016

One last nit: You still have no space betwen // and Sequential mode

Previously, highfive wrote…

New code was committed to pull request.


Reviewed 3 of 3 files at r2.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from Reviewable

@avadacatavra avadacatavra force-pushed the avadacatavra:layout-new branch from 1e6bc65 to 824b499 Jun 10, 2016
@highfive
Copy link

highfive commented Jun 10, 2016

New code was committed to pull request.

@metajack
Copy link
Contributor

metajack commented Jun 10, 2016

@bors-servo r+

This looks great. It will be interesting to see if we see a decrease in test times since most of the wpt tests probably fall into the tiny DOM tree category.

Previously, highfive wrote…

New code was committed to pull request.


Reviewed 1 of 1 files at r3.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@bors-servo
Copy link
Contributor

bors-servo commented Jun 10, 2016

📌 Commit 824b499 has been approved by metajack

@bors-servo
Copy link
Contributor

bors-servo commented Jun 10, 2016

Testing commit 824b499 with merge 900ff71...

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

<!-- Please describe your changes on the following line: -->
Added dom count to documents to track number of objects in dom. Changed layout_thread to always create the thread pool, then check to see if it should be parallel/or sequential when it's used.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix part of #10110  (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because @metajack and I aren't sure how to

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/11713)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jun 10, 2016

💔 Test failed - windows

@metajack
Copy link
Contributor

metajack commented Jun 10, 2016

@bors-servo retry

@larsbergstrom
Copy link
Contributor

larsbergstrom commented Jun 10, 2016

@metajack
Copy link
Contributor

metajack commented Jun 11, 2016

@bors-servo p=2

will help in london

@bors-servo
Copy link
Contributor

bors-servo commented Jun 15, 2016

💔 Test failed - mac-rel-wpt

@highfive
Copy link

highfive commented Jun 15, 2016

  ▶ FAIL [expected PASS] /html/rendering/non-replaced-elements/flow-content-0/div-align.html
  └   → /html/rendering/non-replaced-elements/flow-content-0/div-align.html 0fa0d794dc32120bbc32a401c0bf612808148976
/html/rendering/non-replaced-elements/flow-content-0/div-align-ref.html 158d8fe8cbec2c3121f56130ef092d51a21491ef
Testing 0fa0d794dc32120bbc32a401c0bf612808148976 == 158d8fe8cbec2c3121f56130ef092d51a21491ef

  ▶ FAIL [expected PASS] /_mozilla/css/overconstrained_block.html
  └   → /_mozilla/css/overconstrained_block.html 16bde43a535ed508af41c165882e9e909fa79450
/_mozilla/css/overconstrained_block_ref.html 0c1ff3395cd1542c73375a3b674286f1380893c4
Testing 16bde43a535ed508af41c165882e9e909fa79450 == 0c1ff3395cd1542c73375a3b674286f1380893c4
@bors-servo
Copy link
Contributor

bors-servo commented Jun 20, 2016

The latest upstream changes (presumably #11754) made this pull request unmergeable. Please resolve the merge conflicts.

@KiChjang
Copy link
Member

KiChjang commented Aug 16, 2016

What's the status of this? @mbrubeck is on leave now, so who's owning this PR?

@KiChjang
Copy link
Member

KiChjang commented Aug 16, 2016

Oh, superseded by #12862.

@KiChjang KiChjang closed this Aug 16, 2016
bors-servo added a commit that referenced this pull request Aug 17, 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 added a commit that referenced this pull request Nov 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 added a commit that referenced this pull request Nov 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 added a commit that referenced this pull request Nov 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 added a commit that referenced this pull request Nov 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 added a commit that referenced this pull request Nov 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 added a commit that referenced this pull request Nov 14, 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 added a commit that referenced this pull request Nov 15, 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 added a commit that referenced this pull request Nov 16, 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 added a commit that referenced this pull request Nov 18, 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 added a commit that referenced this pull request Nov 28, 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 added a commit that referenced this pull request Dec 5, 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 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 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 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 -->
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.

None yet

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