Debug build performance

I write raytracer in rust and I notice that debug performance is 100 times slower then release performance which contradict my expectation 2 to 4 times.
I use nalgebra as linear algebra lib which I suspect that can cause the problem.
What do you think can cause such huge difference, what you will propose to me to increase debug performance (like build flags)

These are the default optimization levels:

opt-level = 0

opt-level = 3

You can add them and change the dev opt-level to 1 or 2 to get somewhat better performance for somewhat slower compilation.

1 Like

This might also help you:

Edit: Just noticed the thread is quite old, the official docs are now at Profiles - The Cargo Book

1 Like