Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upMake the main bevy crate a dylib #791
Comments
|
This should be only enabled during debugging. |
|
With |
|
Ok wow thats absolutely wild: 3d_scene (dylib)3d_scene (default)@bjorn3 are there any downsides to using dylib over rlib? |
|
If using it for the final compilation, it will require you to ship the dylib and |
|
Cool cool. It sounds like this should probably be the default for dev workflows (either somehow hard coded into cargo.toml for dev profiles, or just via documentation) . I can't believe a "one line" change makes such a huge difference. Thanks for putting in the work here to gather data / optimize. I'm sure a lot of Bevy developers will be happy you found this |
|
I'm certainly ecstatic! |
|
(Also thanks for your work on |
|
I can't find a good way to enable this in cargo.toml, but only for dev builds. I think we might be blocked on rust-lang/cargo#7878. I also can't find a way to pass this in as an argument to So far the best options I know of:
|
|
If any crate is only available as dylib |
|
I added a section for cargo performance and opened rust-lang/cargo#8833 for the results. |
Another downside (for release builds) I can think of is that it can limit optimizations if using LTO, reducing the usefulness of LTO. When everything is linked statically, enabling LTO allows optimizations/inlining to be performed across crates, which can greatly benefit the performance of the app. Having bevy as a separate binary creates a barrier for optimizations between bevy and the app. |




What problem does this solve or what need does it fill?
Incremental compilation times could be lower.
Describe the solution would you like?
Add
crate-type = ["dylib"]toCargo.tomlor addcrate-type = ["rlib", "dylib"]toCargo.tomland-Cprefer-dynamicto the fast compilation profile. On my system it improves the compilation times of the breakout example from 2.1s with the fast compilation profile to 0.9s.Describe the alternative(s) you've considered?
A lot of different compilation options.
Additional context
I wrote a report of my benchmarking at https://hackmd.io/@bjorn3/BJCQC1eKD