Compile time improvement: depend on subcrates #319
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
bevy_egui
was causing compilation of our large projects to delay untilbevy
, and more critically,bevy_pbr
were done compiling.bevy_pbr
is extremely slow, and depends onbevy_render
, which is also slow to compile. The result is compilation cannot parallelize well.This change should be entirely idempotent for users, it simply switches dependencies to the bevy subcrates. The effect of this is that bevy_egui, and anything that depend on it, can now start compiling at the same time as
bevy_pbr
, this had a huge positive effect on compile times in our larger project, because many things depend onbevy_egui
.The only "gotcha" here is that I had to depend on
encase
manually, otherwise you end up needing to go through bevy'sShaderType
derive, which falls over whenbevy
is not in scope.Using
--timings
on thesimple
example, on an M3 Max:Before
After
As expected, this has no impact on the compile time of examples, because
bevy_pbr
still dominates, but in real applications, you will usually have a bunch of crates depending onbevy_egui
, which can now start compiling a whole 4 seconds earlier (and even more on slower machines).