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

Improve Stylo compile times #101

Open
nicoburns opened this issue Dec 22, 2024 · 2 comments
Open

Improve Stylo compile times #101

nicoburns opened this issue Dec 22, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@nicoburns
Copy link
Collaborator

nicoburns commented Dec 22, 2024

Upstream bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1938784

Stylo is slow to compile! It can take 30+ seconds (Apple M1 Pro under load from also compiling other code), and doesn't parallelise well. This is particularly noticeable for Blitz where overall compile for a minimal build are only 50s, but also shows up as a compile time outlier in Servo builds. Let's see if we can make it faster.

Notes

  • Due to building as a single crate, the style crate's compilation is poorly parallelised. Other large crates can take as long to compile in total but are parallelised over 10 cores so ends up having a much smaller impact on overall compile time.
  • The style crate spends an unusually high proportion of time in the compiler frontend. I suspect this may be due to the large size of the crate, and some rustc codepaths having non-linear time complexity with respect to the size of a crate.

Ideas

  • Split "support code" into their own crate (e.g. gecko_bindings shouldn't depend on style)
  • Split values/properties modules into crates by related property (e.g. "core numeric types" (e.g. Length, LengthPercentage, etc), one for "color types", one for "flexbox types", one for "css grid types") which can then compile in parallel / pipelined.
@nicoburns nicoburns added the enhancement New feature or request label Dec 22, 2024
@mrobinson
Copy link
Member

@nicoburns
Copy link
Collaborator Author

Ah yes, updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants