This bugzilla service is closed. All entries have been migrated to
Bug 1673 - Debug mode is unusably slow
Summary: Debug mode is unusably slow
Status: NEW
Alias: None
Product: Eigen
Classification: Unclassified
Component: General (show other bugs)
Version: 3.3 (current stable)
Hardware: All Windows
: Normal Performance Problem
Assignee: Nobody
Depends on:
Reported: 2019-01-28 16:40 UTC by Nathaniel Bogan
Modified: 2019-12-04 18:26 UTC (History)
5 users (show)

Source for slow Debug (2.58 KB, text/plain)
2019-01-28 16:40 UTC, Nathaniel Bogan
no flags Details
Build batch file (353 bytes, text/plain)
2019-01-28 16:40 UTC, Nathaniel Bogan
no flags Details

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:

Note You need to log in before you can comment on or make changes to this bug.