Created attachment 920 [details]
Source for slow Debug
We have been hoping to embrace Eigen for all of our linear algebra needs, but we have found that the debug mode performance is so slow as to be nearly equivalent to not having a debug mode. As is, the library is not usable for our purposes.
The attached piece of code and batch file demonstrate one representative scenario. On a slightly old machine, my output is as follows:
Eigen resize msec: 3549
Eigen init msec: 11082
Simple dot msec: 386
Eigen dot msec: 20267
Eigen resize msec: 23
Eigen init msec: 339
Simple dot msec: 38
Eigen dot msec: 55
An operation that takes 55 msec in release mode takes over 20 seconds in debug mode, or about 370x slower. We have many tool that run in the 500ms-1sec range, so this sort of factor results in taking many minutes in Debug mode, and thus is not useful, forcing old-school print statements instead.
The "boneheaded" implementation that I provide is about 7x slower in debug mode, which is within expectations and quite usable.
Created attachment 921 [details]
Build batch file
With clang, gcc, icc, etc. you can compile with "-g -O2" to get both speed and debugging facilities.
As I never use MSVC, I don't have good advice for you, but there are likely many tips on SO, e.g.:
Those huge slow downs mostly come from the lack of inlining. So perhaps you could create a DebugWithInl configuration copied from Debug and slightly tuned to enable inlining, maybe with "/Ob"?
Please, share your findings so that we can share them to other users.