This bugzilla service is closed. All entries have been migrated to

Bug 1673

Summary: Debug mode is unusably slow
Product: Eigen Reporter: Nathaniel Bogan <Nathaniel.Bogan>
Component: GeneralAssignee: Nobody <eigen.nobody>
Status: NEW ---    
Severity: Performance Problem CC: chtz, gael.guennebaud, jacob.benoit.1, Nathaniel.Bogan, viric
Priority: Normal    
Version: 3.3 (current stable)   
Hardware: All   
OS: Windows   
Description Flags
Source for slow Debug
Build batch file none

Description Nathaniel Bogan 2019-01-28 16:40:04 UTC
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:

$ ./EigenTestDebug.exe
Eigen resize msec: 3549
Eigen init msec: 11082
Simple dot msec: 386
Eigen dot msec: 20267

$ ./EigenTestRelease.exe
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.
Comment 1 Nathaniel Bogan 2019-01-28 16:40:58 UTC
Created attachment 921 [details]
Build batch file
Comment 2 Gael Guennebaud 2019-01-28 17:02:05 UTC
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.
Comment 3 Nobody 2019-12-04 18:26:33 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: