bevy-website icon indicating copy to clipboard operation
bevy-website copied to clipboard

Should I enable dynamic linking when using mold?

Open Khayet opened this issue 2 years ago • 1 comments

How can Bevy's documentation be improved?

Hi, I stumbled over some conflicting advice in the section on fast compiles:

https://bevyengine.org/learn/quick-start/getting-started/setup/#enable-fast-compiles-optional

Of course I want to have the fastest compiles possible, so I'm enabling everything that the docs recommend, including

  • enabling dynamic linking
  • using mold instead of lld or the default linker

..but then later there's a note that says

"NOTE: Disabling bevy/dynamic_linking may improve the performance of this linker."

As a new user this is confusing to me - do you recommend to NOT use dynamic linking with mold or should I use dynamic linking with mold. I assume that the actually optimal setting depends on my system and my code but as a newbie, I have no way to find that out, so I would appreciate it if the docs just gave a clear recommendation like "Use dynamic linking if you are linking with lld, do not enable dynamic linking if you are linking with mold.".

Thank you!

Khayet avatar Mar 09 '24 20:03 Khayet

I believe the vague wording is because there hasn't been solid performance benchmarks to prove either way. Anecdotally when running dynamic linking, and no dynamic linking, with mold on my (small) project it generally came out to:

2 mins to build initially on both (with a random one where dynamically linking took 3), 0.14 seconds to build with no changes on both, 2 seconds to rebuild changes with dynamic linking, 18 seconds to rebuild changes without dynamic linking.

So, it's a your mileage may vary scenario; the person who initially wrote that probably got results that were the opposite of mine. (We should probably re-word that on the site though since you're not the first to be confused).

TrialDragon avatar Mar 09 '24 21:03 TrialDragon