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 size_of tests measure stylo and reduce the size of stylo PropertyDeclarations by 16 bytes #15953

Merged
merged 3 commits into from Mar 15, 2017

Conversation

bholley
Copy link
Contributor

@bholley bholley commented Mar 15, 2017

Right now they don't, which means that we have four properties making PropertyDeclaration 16 bytes bigger than it should be.

I'm not sure if there's a better way to get these tests to run against stylo than to hoist them into the properties file, but I couldn't figure it out. This seems good enough.


This change is Reviewable

MozReview-Commit-ID: GMd1Huv8N5s
@highfive
Copy link

Heads up! This PR modifies the following files:

  • @emilio: components/style/properties/longhand/list.mako.rs, components/style/properties/properties.mako.rs, components/style/properties/longhand/inherited_svg.mako.rs

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Mar 15, 2017
@bholley
Copy link
Contributor Author

bholley commented Mar 15, 2017

r? @Manishearth

@highfive highfive assigned Manishearth and unassigned mbrubeck Mar 15, 2017
@bholley
Copy link
Contributor Author

bholley commented Mar 15, 2017

@bors-servo try

@bors-servo
Copy link
Contributor

⌛ Trying commit 502e393 with merge 537cd0e...

bors-servo pushed a commit that referenced this pull request Mar 15, 2017
Make size_of tests measure stylo

Right now they don't, which means that we have four properties making PropertyDeclaration 16 bytes bigger than it should be.

I'm not sure if there's a better way to get these tests to run against stylo than to hoist them into the properties file, but I couldn't figure it out. This seems good enough.

<!-- 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/15953)
<!-- Reviewable:end -->
@bholley
Copy link
Contributor Author

bholley commented Mar 15, 2017

I guess the other question is whether non-stylo test runs actually run tests from components/style or whether they're strictly limited to tests/unit/style. We certainly shouldn't disable these tests for normal servo runs.

CC @wafflespeanut

@bholley
Copy link
Contributor Author

bholley commented Mar 15, 2017

Also, the reason those properties are so large is that we have a bunch of extra fields on URL specified values for stylo.

let new = size_of::<PropertyDeclaration>();
if new < old {
panic!("Your changes have decreased the stack size of PropertyDeclaration enum from {} to {}. \
Good work! Please update the size in tests/unit/style/size_of.rs.",
Copy link
Member

Choose a reason for hiding this comment

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

This message references the old file.

These enum is present in large quantities in the style, and increasing the size \
may negatively affect style system performance. Please consider using `boxed=\"True\"` in \
the longhand If you feel that the increase is necessary, update to the new size in \
tests/unit/style/size_of.rs.",
Copy link
Member

Choose a reason for hiding this comment

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

This message references the old file.

@Manishearth
Copy link
Member

I guess the other question is whether non-stylo test runs actually run tests from components/style or whether they're strictly limited to tests/unit/style

It doesn't. There aren't supposed to be tests in components/, the only reason style is an exception is that bindgen generates layout tests inline and we have to run those for stylo. So you probably want to export a function that can be called from tests/unit and components/style

@bors-servo
Copy link
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-gnu-dev, windows-msvc-dev
State: approved= try=True

@wafflespeanut
Copy link
Contributor

wafflespeanut commented Mar 15, 2017

We should consider having another size_of module in stylo_tests and enable both testing and gecko features for the style crate. Then, we can test this using ./mach test-stylo

@SimonSapin
Copy link
Member

@bholley This PR adds a #[test] function in the style crate, but I think that test will never be run in our current CI. To run it you’d need to change something in python/servo so that either ./mach test-unit or ./mach test-stylo also runs cargo test -p style.

However that involves recompiling the entire style crate (with --test passed to rustc) which take some time. To avoid that the test can be in a separate crate, either similar to tests/unit/style (as a Cargo "package" with its own Cargo.toml file) or what Cargo calls an integration test (which is a separate crate from the point of view of rustc, but not a separate package as far as Cargo is concerned).

@wafflespeanut
Copy link
Contributor

... or, simply make a copy of size_of (or move it) to stylo tests, so that it can be tested there.

@nox nox 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 15, 2017
MozReview-Commit-ID: KapDMqX6OjH
@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 15, 2017
@bholley
Copy link
Contributor Author

bholley commented Mar 15, 2017

Fixed up. r? @Manishearth

@bholley bholley changed the title Make size_of tests measure stylo Make size_of tests measure stylo and reduce the size of stylo PropertyDeclarations by 16 bytes Mar 15, 2017
@Manishearth
Copy link
Member

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 6744ed1 has been approved by Manishearth

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

⌛ Testing commit 6744ed1 with merge f5c67fd...

bors-servo pushed a commit that referenced this pull request Mar 15, 2017
Make size_of tests measure stylo and reduce the size of stylo PropertyDeclarations by 16 bytes

Right now they don't, which means that we have four properties making PropertyDeclaration 16 bytes bigger than it should be.

I'm not sure if there's a better way to get these tests to run against stylo than to hoist them into the properties file, but I couldn't figure it out. This seems good enough.

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

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-gnu-dev, windows-msvc-dev
Approved by: Manishearth
Pushing f5c67fd to master...

@bors-servo bors-servo merged commit 6744ed1 into servo:master Mar 15, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Mar 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants