4 ms·
If you are trying Bevy for the first time, and it runs slow, put this on your Cargo.toml [profile.dev.package."*"] opt-level = 3
by 29athrowaway 3y ago
If you are trying Bevy for the first time, and it runs slow, put this on your Cargo.toml
[profile.dev.package."*"]
opt-level = 3
- diggan 3y agoThis + more is described if you follow the Quickstart, which if it's your first time, is probably the best place to get started quickly :) https://bevyengine.org/learn/quick-start/getting-started/setup/ https://bevyengine.org/learn/quick-start/getting-started/set...
- 29athrowaway 3y agoYes. But when I tried the tutorials, the performance issue was an instant turn down. With this, the frame rate immediately went from 13 fps to 60 fps.
- flohofwoe 3y agoThe curse of "zero cost abstraction" strikes again :/ A 5x performance difference between debug and release mode isn't uncommon in C++ either and a real problem for game development (plus the slow build times, but those two problems go hand in hand - you can have "high-level abstractions" that build slowly and run fast, or build fast and run slowly). That's why there's so much advice to write C-like C++ and also ignore the stdlib in gamedev circles. The Rust equivalent is probably to write "embedded style Rust".
- kookamamie 3y agoDebug mode isn't always needed, though - E.g. C++ with RelWithDebInfo gets you far enough, unless you specifically want to run debugger - I'm one of those who do not use a debugger in their workflow, so a non-issue for me.
- flohofwoe 3y agoThat's been my fallback solution too in C++ in the past and it kinda works (and Visual Studio has a special option /Zo since quite a while https://learn.microsoft.com/en-us/cpp/build/reference/zo-enhance-optimized-debugging?view=msvc-170 https://learn.microsoft.com/en-us/cpp/build/reference/zo-enh..., not sure though if that's actually used by cmake's "RelWithDebugInfo" config), but there's still downsides even when not using a debugger. Most importantly: if you have a crash/assert handler which logs out a callstack, that callstack may sometimes be quite misleading (depending on how much the optimiser passes have mangled the compiler output relative to the input source code).
- littlestymaar 3y agoHow is that a curse? With rust you can simply compile your dependencies in release mode while keeping your own code in debug, and it's often performant enough because most of the time the perf sensitive stuff isn't in the app logic itself.
- diggan 3y agoYeah, I'm guessing that's exactly why that step is like step #3 in the official quickstart tutorial.
- zamalek 3y agoUsing LLD/Mold is another pro-tip from Bevy that all projects - possibly RustC - should adopt.
- diggan 3y agoAgree! Also outlined in the official Quickstart docs, and that one I've gotten a lot of use of outside of Bevy too.