Skip to content

Rendering makes up 75% of compile time #23642

@TimJentzsch

Description

@TimJentzsch

Background: Discussion on Discord with @ChristopherBiscardi and @Elabajaba.

Bevy version

Tested on main, commit 45e454a83bffd7a496621ba77bc3429fa472733d.

System information

  • Linux (Pop!_OS), Ryzen 9 9950x3d CPU
  • cargo 1.96.0-nightly (888f67534 2026-03-30)

Reproduction

Run cargo clean && cargo build --timings --example 3d_scene, then inspect the generated timings file.

Mine is here for reference: https://gist.github.com/TimJentzsch/3fcc84bc8dfa261f7775ade2b2cb274b

Results

Image

The flamegraph shows that a large part of the compilation is spent on a waterfall of rendering crates that is largely compiled sequentially.

The critical path here is:

  1. bevy_render: 25.15s
  2. bevy_core_pipeline: 17.04s
  3. bevy_pbr: 43.61s
  4. bevy_gizmos_render: 5.4s

These rendering crates sum up to 91.2s, which is 76% of the total compile time.
About half of that is bevy_pbr.

Comparison with Bevy ~0.12

The original discussion was about comparing compile times with an old Bevy version, commit 22e39c4 (v0.12) that @IceSentry benchmarked back in 2024.
On https://github.com/TimJentzsch/bevy/tree/old-bevy is a small patch of this commit (figured out by @Elabajaba) that still compiles today.

Timings on my system:

Image

Full timings: https://gist.github.com/TimJentzsch/ae10132cc0b6b20f9b74245008183c50

Notably, the compile time is only ~17% of what it is today.
bevy_pbr takes over 17 times as long now.

Of course, it's not a fair comparison, Bevy's feature set has grown massively since then, especially with regards to rendering. But still interesting to see the differences.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-Build-SystemRelated to build systems or continuous integrationA-RenderingDrawing game state to the screenC-PerformanceA change motivated by improving speed, memory usage or compile times

    Type

    No type

    Projects

    Status

    Needs SME Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions