Digital-Humans-23 / a1

7 stars 0 forks source link

Slow performance on debug #7

Closed Pablo-Paniagua closed 1 year ago

Pablo-Paniagua commented 1 year ago

This is not really a big issue, but it did have me wondering for a while. Naturally running on debug mode takes a toll on performance, but I found that this is particularly true when working with Eigen. I could not get more than 3 fps from the simulation when running on the debug build (even if not on debug mode). I write this just in case someone else is wondering why the application looks so slow, just build it for release and it will give you a more like 30fps (depending on your computer).

Other people seem to have had similar observations and an open issue is currently present on GitLab for Eigen. Not much is discussed and maybe someone has more information.

eastskykang commented 1 year ago

Hi,

C/C++ compilers has an option for choosing the level of optimization. In release mode, the compilers use the highest level of optimization. This ensures fast execution, but this means, at the same time, it skips every information debugger uses. That's why you are not able to use useful features such as breakpoints in Release mode.

Eigen library uses so many tricks to optimize the performance (in terms of computation, memory consumption etc...), and in debug mode, those optimization tricks are kind of "disabled". Furthermore, it even injects some assertion for checking dimension so on in Debug mode. That's why it's very slow in Debug mode (but definitely provide more rich information useful for programmer to debug their implementation)

Hope this helps!