How to improve link performance for a large C++ application in VS2005

前端 未结 15 1508
野的像风
野的像风 2020-12-02 11:30

We have fairly large C++ application which is composed of about 60 projects in Visual Studio 2005. It currently takes 7 minutes to link in Release mode and I would like to t

相关标签:
15条回答
  • 2020-12-02 12:04

    you can try looking at this: http://msdn.microsoft.com/en-us/library/9h3z1a69.aspx

    Basically, you can run project builds in parallel if you have several cores.

    0 讨论(0)
  • 2020-12-02 12:10

    I just found out that we had by accident defined a large table of strings in a header file which got included in pretty much every (static) lib. (I am talking about a huge C++ project.) When the linker created the EXE, it looks like the unification of the table (there is only a single one ending up in the EXE) or the parsing of the libs took forever. Putting the table in a separate C++ file took a couple of minutes of the link on a relatively slow machine.

    Unfortunately, I don't know how to find stuff like that other than by chance.

    0 讨论(0)
  • 2020-12-02 12:16

    Take a look at Incredibuild by Xoreax. Its distributed compilation dramatically reduced our full build/link times from around 40 minutes to 8 minutes.

    Additionally, this product has a feature they call Incredilink which should help you get incremental links working even with statically linked libraries.

    0 讨论(0)
  • 2020-12-02 12:16

    I had solved my link problem and share to all of you.

    My project's link time was 7 min with /Incremental:no linking (link time 7min).

    Was 15 min with /Incremental, (link time 7min, embeded manifest time 7min). So I turn off the inremental.

    I found Additional dependencies has a.lib AND ignore specific libraries has, too!

    So I remove it from Ignore specific libraries turn on the /incremental. first link time need 5min but embeded manifest time has none.

    I don't know why, but the incremental linking has worked.

    I rollback all project code , so I could find the problem by the lib. If you do all of above, you can try my method. Good luck!

    0 讨论(0)
  • 2020-12-02 12:19

    Several people have reported (and I myself have noticed) that modifying a file in a statically linked library will disable incremental linking for the entire solution; this appears to be what you are seeing. See comments here and here for some information about that.

    One workaround is to use the Fast Solution Build Add-In. This might involve making a few changes to your workspace, but the payoff is definitely worth it. For a commercial solution, use Xoreax's Incredibuild, which basically incorporates this same technology but adds other features as well. I apologize if I sound like a salesman for Incredibuild - I'm just a very satisfied customer.

    0 讨论(0)
  • 2020-12-02 12:19

    60 libs to link does sound like a fair few. This may be a bit of an extreme measure, but it might radically speed things up. Create a new solution, with a few projects, and add all the source from your existing projects to these. Then build and link them instead, and just keep the small ones for testing.

    0 讨论(0)
提交回复
热议问题