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

Make ToCss' SequenceWriter not monomorphise like a maniac anymore #19838

Merged
merged 4 commits into from Jan 23, 2018

Conversation

@nox
Copy link
Member

nox commented Jan 22, 2018

This change is Reviewable

@highfive
Copy link

highfive commented Jan 22, 2018

Heads up! This PR modifies the following files:

  • @bholley: components/style/values/computed/position.rs, ports/geckolib/glue.rs, components/style/stylesheets/style_rule.rs, components/style/properties/shorthand/background.mako.rs, components/style/gecko/url.rs and 83 more
  • @canaltinova: components/style/values/computed/position.rs, components/style/stylesheets/style_rule.rs, components/style/properties/shorthand/background.mako.rs, components/style/gecko/url.rs, components/style/values/computed/basic_shape.rs and 82 more
  • @emilio: components/style/values/computed/position.rs, ports/geckolib/glue.rs, components/style/stylesheets/style_rule.rs, components/style/properties/shorthand/background.mako.rs, components/style/gecko/url.rs and 83 more
  • @fitzgen: components/script/dom/cssstyledeclaration.rs, components/script/dom/mediaquerylist.rs, components/script/dom/medialist.rs
  • @KiChjang: components/script/dom/cssstyledeclaration.rs, components/script/dom/mediaquerylist.rs, components/script/dom/medialist.rs
  • @asajeffrey: components/script/dom/cssstyledeclaration.rs, components/script/dom/mediaquerylist.rs, components/script/dom/medialist.rs
@highfive
Copy link

highfive commented Jan 22, 2018

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify style and script code, but no tests are modified. Please consider adding a test!
@nox
Copy link
Member Author

nox commented Jan 22, 2018

@nox
Copy link
Member Author

nox commented Jan 22, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Jan 22, 2018

Trying commit a0cf705 with merge 2e32dbf...

bors-servo added a commit that referenced this pull request Jan 22, 2018
Make ToCss' SequenceWriter not monomorphise like a maniac anymore
@bors-servo
Copy link
Contributor

bors-servo commented Jan 22, 2018

💔 Test failed - linux-rel-wpt

@nox nox force-pushed the rm-sequence-writer-as-it-was branch from a0cf705 to 4743dc3 Jan 22, 2018
@nox
Copy link
Member Author

nox commented Jan 22, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Jan 22, 2018

Trying commit 4743dc3 with merge 3ff184c...

bors-servo added a commit that referenced this pull request Jan 22, 2018
Make ToCss' SequenceWriter not monomorphise like a maniac anymore

<!-- 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/19838)
<!-- Reviewable:end -->
@emilio
emilio approved these changes Jan 22, 2018
Copy link
Member

emilio left a comment

/me likes :)

Not sure if you want to wait for @SimonSapin's / @bholley's review or not, if you don't just feel free to land with r=me.

None, None /* No extra custom properties */);
.single_value_to_css(
&get_property_id_from_nscsspropertyid!(property, ()),
&mut CssWriter::new(&mut string),

This comment has been minimized.

@emilio

emilio Jan 22, 2018

Member

We should make this pass buffer directly. Mind filing an issue? Though I don't recall if @bholley's patch fixed this.

has_written: false,
let has_prefix = self.inner.prefix.is_some();
if !has_prefix {
self.inner.prefix = Some(self.separator);

This comment has been minimized.

@emilio

emilio Jan 22, 2018

Member

oh, smart :)

where
W: Write,
{
/// Creates a new `CssWriter`.

This comment has been minimized.

@emilio

emilio Jan 22, 2018

Member

nit: Maybe #[inline]

/// A writer tailored for serialising CSS.
///
/// Coupled with SequenceWriter, this allows callers to transparently handle
/// things like comma-separated values etc.

This comment has been minimized.

@emilio

emilio Jan 22, 2018

Member

Maybe put an example of how this is used? I had to read it a bit carefully.

In particular, what state does prefix represent? If I'm not wrong, when writing a sequence:

  • We start with prefix = Some("").
  • On the first item, assuming it writes something, it takes the prefix.
  • On the second one, since there's no prefix, we set prefix: Some(sequence_separator), and reset it after the to_css call begins.
  • ...
self.has_written = true;
item.to_css(&mut self.inner)?;
if !has_prefix {
self.inner.prefix = None;

This comment has been minimized.

@emilio

emilio Jan 22, 2018

Member

I think it'd be nice, more as a self-documenting assert than as a sanity-check, that in this case self.inner.prefix is either None or self.separator before the assignment (since even though it can change down the line, it should always be mutated by another SequenceWriter, and thus resetted too.

@bors-servo
Copy link
Contributor

bors-servo commented Jan 22, 2018

💔 Test failed - linux-dev

@nox nox force-pushed the rm-sequence-writer-as-it-was branch from 4743dc3 to bd7e68d Jan 22, 2018
@nox nox force-pushed the rm-sequence-writer-as-it-was branch from bd7e68d to 0bf70dc Jan 22, 2018
@nox
Copy link
Member Author

nox commented Jan 22, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Jan 22, 2018

Trying commit 0bf70dc with merge f93f875...

bors-servo added a commit that referenced this pull request Jan 22, 2018
Make ToCss' SequenceWriter not monomorphise like a maniac anymore

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

bors-servo commented Jan 22, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Jan 22, 2018

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

nox added 3 commits Jan 22, 2018
This more concrete wrapper type can write a prefix the very first time something
is written to it. This allows removing plenty of useless monomorphisations caused
by the former W/SequenceWriter<W> pair of types.
@bors-servo
Copy link
Contributor

bors-servo commented Jan 23, 2018

💔 Test failed - mac-dev-unit

Now that SequenceWriter<W> does not monomorphise excessively, we can actually
type check a derived ToCss without too much type recursion.
@nox nox force-pushed the rm-sequence-writer-as-it-was branch from 04e7cce to 42c8dc9 Jan 23, 2018
@bors-servo
Copy link
Contributor

bors-servo commented Jan 23, 2018

Trying commit 42c8dc9 with merge e9b8fea...

bors-servo added a commit that referenced this pull request Jan 23, 2018
Make ToCss' SequenceWriter not monomorphise like a maniac anymore

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

bors-servo commented Jan 23, 2018

💔 Test failed - arm32

@emilio
emilio approved these changes Jan 23, 2018
@emilio
Copy link
Member

emilio commented Jan 23, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Jan 23, 2018

📌 Commit 42c8dc9 has been approved by emilio

@nox
Copy link
Member Author

nox commented Jan 23, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Jan 23, 2018

Testing commit 42c8dc9 with merge 6b2e528...

bors-servo added a commit that referenced this pull request Jan 23, 2018
Make ToCss' SequenceWriter not monomorphise like a maniac anymore

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

bors-servo commented Jan 23, 2018

@bors-servo bors-servo merged commit 42c8dc9 into master Jan 23, 2018
3 of 5 checks passed
3 of 5 checks passed
Taskcluster (pull_request) TaskGroup: failure
Details
continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
dependency-ci Dependencies checked
Details
homu Test successful
Details
@nox nox deleted the rm-sequence-writer-as-it-was branch Jan 24, 2018
@ionutgoldan
Copy link

ionutgoldan commented Jan 25, 2018

Good news! This noticeably reduced build times on Windows.

== Change summary for alert #11256 (as of Tue, 23 Jan 2018 16:57:02 GMT) ==

Improvements:

9% build times windows2012-64 opt rusttests taskcluster-c4.4xlarge 2,321.94 -> 2,103.34
9% build times windows2012-32 opt rusttests taskcluster-c4.4xlarge 2,302.99 -> 2,090.30
9% build times windows2012-32 opt taskcluster-c4.4xlarge 2,580.50 -> 2,348.30
9% build times windows2012-64 opt taskcluster-c4.4xlarge 2,664.19 -> 2,437.35
8% build times windows2012-64 opt static-analysis taskcluster-c4.4xlarge2,580.59 -> 2,369.24
8% build times windows2012-32 opt static-analysis taskcluster-c4.4xlarge2,255.28 -> 2,079.92
4% build times windows2012-32 pgo taskcluster-c4.4xlarge 4,346.07 -> 4,185.03

For up to date results, see: https://treeherder.mozilla.org/perf.html#/alerts?id=11256

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

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