如何加快c ++链接时间 [英] How to speed up c++ linking time

查看:97
本文介绍了如何加快c ++链接时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法,以优化链接时间在MS Visual studio C ++(2005)?我们使用Xoreax Incredibuild编译加速,但没有链接。

Is there any way, to optimalize linking time in MS Visual studio C++ (2005) ? We're using Xoreax Incredibuild for compilation speed up, but nothing for link.

目前每个链接大约需要30秒。当我打开增量链接,需要35-40秒。 (无论我是否编译项目有或没有incredibuild)

Currently every linking takes about 30seconds. When I turn on incremental linking, takes abou 35-40 seconds. ( No matter if i compile project with or without incredibuild )

有什么办法,如何剖析连接器,看看需要多长时间?或任何工具的paralel链接?

Is there any way, how to profile linker and watch how long what takes ? Or any tool for paralel linking ? Or any tips for code optimalization to speed up linker ?

感谢您的回复
Ludek Vodicka

Thanks for reply Ludek Vodicka


编辑:

感谢您的第一个回覆以及其他资讯:

Thanks for first replies, and additional info:


  • 整个计划优化和链接时间代码生成已关闭。

  • PIMPL成语已尽可能使用

  • 其他静态库已经通过#pragma注释(lib,pathToLib)包含。 (也是因为更容易维护)

  • HW:四核q6600,8GB ram,3x WD猛禽RAID 0. Windows Vista 64位

推荐答案

我不知道任何并行链接工具;我知道Incredibuild不允许它。

I'm not aware of any parallel linking tools; I do know that Incredibuild does not allow it.

你的工具箱中避免链接时间最大的工具是适当的抽象级别。如果你的链接时间很长,可能是因为对象对其他对象的知识太多,抽象接口(也许使用PIMPL范例),或者通过其他方法如事件传递。

The biggest tool in your toolbox for avoiding link times is the appropriate level of abstraction. If your link times are long, it may be because objects know too much about other objects. Decoupling them is then the key -- through abstract interfaces (perhaps using the PIMPL paradigm), or though other methods such as event passing.

通过项目依赖关系链接项目的开销也相当高。平台是Win32或主要,你可以考虑使用头通过#pragma注释(lib,pathToLib)链接你的依赖库。

The overhead for linking projects through Project Dependencies is also quite high. If your target platform is Win32 only, or primarily, you may consider using a header to link your dependent libraries via #pragma comment(lib, "pathToLib").

这篇关于如何加快c ++链接时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆