views:

344

answers:

3

I am working with a large bunch of sources written in Visual C++. The target is dll library. Linkage time consumes several minutes. How this time can be reduced?

Library depends on other dlls and libs, which are in the same solution.

The first thing which can be done is to split source into several projects, but it is a time consuming approach and very expensive.

Possibly some other approaches exist which can be used in my situation.

EDIT: I use incremental linkage, although this reduces time drastically, but this is not enough for me. There is not a problem for size of object file, because the most annoying thing is development of such code base. Every small modification requires waiting me for linkage.

+1  A: 

If you're not using incremental linking, you should look into this. It basically trades final object size against linking performance.

The global optimisation options also move compile time (i.e. code generation) from the compile phase to the link phase - you might find it better to lose them, so that individual file compiles are slower but the link is faster.

Will Dean
Thanks, I used such approaches, I am looking for some other approaches, which can be used as well.
sergdev
+3  A: 

Refactor!!! Split the large DLL into smaller modules, do this using layers of interfaces, create an architecture when you split "huge" DLL into smaller ones as opposed to taking the first 5 files etc. Map the DLL hierarchy carefully level 0 DLL's are standalone, level 1 DLL's may depend on 1 or more level 0, etc.

The effort of doing this will pay off, imagine only 10 developers waiting just 6 minutes a day to link, 10*6 == 1 hour * 5 days a week, this means your losing over half a days development time a week, this should be more than enough to justify a break from feature development to get your ducks in order.

Also you mentioned libraries, if you have the source make these DLL's too, this will payback very quickly when you enable edit & continue.

titanae
A: 

You could try to reduce your include dependencies. Some headers trigger a lot of code to be added to the .obj files, even if nothing in them is really used. Some examples of such headers are and

eli