VS2008 中发布构建时间太长
当我构建项目时,如果发布了,构建时间会花费很多时间。
在发布中,链接时间为:130秒
在调试中,链接时间为:同一项目的15秒。
编译没有什么区别,但是链接就有很大的区别了。
你知道为什么会这样吗?
When i build the project, build time get so much time if it is release.
in release, linking time is : 130secs
in debug, linking time is : 15secs for the same project.
there is no difference in compiling, but linking there is a huge difference.
do you know why it could be?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
由于优化设置,发布版本可能会较慢。 通常,对于调试构建,您没有优化设置 - 这意味着生成的目标文件可能或多或少直接复制到输出中。 另一方面,对于发布版本,您可能有 LTCG 打开或其他链接器优化可能适用。 链接通常受 CPU 限制,并且通常仅在单个线程中运行,因此速度往往会很慢。 输出越大,情况似乎也越糟糕。
Release build is probably slower because of optimisation settings. Typically for a debug build, you don't have optimisation set - this means the generated object files are probably more or less copied straight into the output. On the other hand, for release builds, you may have LTCG turned on or other linker optimisations may apply. Linking is normally CPU bound, and normally only runs in a single thread so it tends to be kind of slow. The bigger the output, the worse this seems to get also.
我的经验是,在链接过程中,大部分时间都花在生成调试信息上。 如果您尝试在没有调试信息的情况下进行链接,则链接时间应该会大大缩短(我正在开发的项目从大约 80 秒缩短到大约 10 秒)。 如果没有,那就是别的事了。 在调试版本中,较长的链接时间也可能是由不正确的增量链接引起的; 我发现链接时间从 1 分钟增加到 5 分钟。 如果您想在保留调试信息的同时减少链接时间,请确保拥有尽可能少的编译单元,因为必须合并所有编译单元的调试信息。 为此,我通过让一个 cpp 文件包含这些 cpp 文件,将多个 cpp 文件合并到一个编译单元中。
问候,
塞巴斯蒂安
My experience is that during linking most of time is spent generating debug info. If you try to link without debug info, the link time should go way down (the project I'm working on goes from about 80 seconds to about 10). If not, it's something else. In debug builds long link times can also be caused by incorrect incremental linking; I saw link times go up from 1 minute to 5 minutes. If you want to decrease link time while still keeping debug info, make sure you have as few compile units as possible, since the debug info of all compile units has to be merged. I do that by combining multiple cpp files into one compile unit by having one cpp file include those cpp files.
Regards,
Sebastiaan
我唯一能想到的就是你将 FxCop 设置为仅在发布模式下运行。 这将导致大型项目的构建时间存在显着差异,因为如果启用,FxCop 将作为构建过程的一部分运行。
您能否向我们提供有关您的解决方案的更多信息? 例如
The only thing I could think of off the top of my head is that you have FxCop set to run in Release mode only. This would cause a significant build time difference on a large project since FxCop runs as part of the build process if enabled.
Can you give us some more information about your solution? For instance