Skip to content

Improve Stylo compile times #101

@nicoburns

Description

@nicoburns

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions