Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance Issues due to Debug Mode #74

Open
desttinghim opened this issue Aug 8, 2020 · 2 comments
Open

Performance Issues due to Debug Mode #74

desttinghim opened this issue Aug 8, 2020 · 2 comments

Comments

@desttinghim
Copy link

desttinghim commented Aug 8, 2020

Section 3.4 states that the game is running slowly due to unbatched draw calls, but the reality is that rust's debug mode is very slow. Compiling in release mode or turning on optimizations when compiling in debug mode will make the game much faster. I added the following to make rust optimize in debug mode:

[profile.dev]
opt-level = 2

Here's a table with the performance I got with the various techniques:

Optimizations Spritebatching FPS
No No 7 fps
No Yes 47 fps
Yes No 144 fps
Yes Yes 144 fps

I know of this technique from following (and occasionally contributing to) veloren, which is a good example of how specs can be used to make a larger game.

@iolivia
Copy link
Owner

iolivia commented Aug 15, 2020

@desttinghim this is super interesting, thanks for the thorough analysis. it's pretty insane the effect the debug optimizations have. this was all with cargo run or cargo run --release? I would be curious to see how batching does in release mode, I think I was using release throughout the whole book. The optimisations flag would not do anything in release right?

@desttinghim
Copy link
Author

This was all with cargo run. The optimizations flag won't do anything in cargo run --release, since only [profile.dev] is changed. You can read more about profiles here: https://doc.rust-lang.org/cargo/reference/profiles.html

Something I should probably note is that my screen refreshes at 144hz, which is why I got 144 fps instead of 60.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants