This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Slow compile times... solutions?

Tags: None
(comma "," separated)
graphicsMan
Registered Member
Posts
16
Karma
0
OS

Slow compile times... solutions?

Mon Aug 08, 2011 6:23 pm
Hi all -

We recently switched from my home-rolled vector/matrix library to Eigen in our code base. For the most part, all is well, but we have a couple of issues:

Compile time is MUCH slower than before. I think it can take several times longer to build our code from scratch. There are some obvious things around reducing header dependencies that we may be able to capitalize on, but in general, have you found any ways to speed up compilations? I'm not so sure that precompiled headers would work well with expression templates... But if you've had luck with that, please speak up.

Debug mode is nearly unbearably slow now. Probably a factor of 30 or 40 instead of 8 or 10 as before. Any hints for faster debug code?

Thanks!
deng
Registered Member
Posts
10
Karma
0
A few hints:

- Optimization takes time, so use -O0 as long as you're just testing.

- Precompiled headers may help, but I'm guessing for Eigen not much.

- Use latest gcc.

- Use a RAM-Disk to reduce IOWait (trivial under Linux), although that usually won't be the problem.

- If it's unbearable, use several machines and distcc.
Hauke
Registered Member
Posts
109
Karma
3
OS
Hi,

we are having the same problems with MSVC. Precompiled headers help a lot though I am using the scarcely since they are somewhat tricky to setup. IIRC, the /LTCG flag also causes a huge overhead in link time but on the other hand-side the generated code is more efficient. With MSVC you typically see the linker stall for several minutes (yes, minutes) on "Generating code ..." which is mostly related to /LTCG.

The compile times in debug mode are fine though you have the aforementioned run-time impact.

Another thing I have read (I think in the boost Geometry docs) is setting _SECURE_SCL=0 and _HAS_ITERATOR_DEBUGGING=0. I am not sure about these and have not tested them myself.

HTH,
Hauke
eudoxos
Registered Member
Posts
36
Karma
0
For running your code in debug mode, you could
Code: Select all
#define EIGEN_NO_DEBUG
before including eigen headers. That will push the debug-build performance of your code up a bit, for the obvious price of skipping assertions inside eigen code (which includes IIRC out-of-bounds index checking).
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
For debuging without a significant slowdown, you can try with -g2 -O1. For the compilation time issue, precompiled headers help a lot on Linux too. You need gcc 4.3 or greater to really get compilation time improvements.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]