与黄金链接器链接的二进制文件运行速度更快吗? [英] Is binary linked with gold linker running faster?

查看:130
本文介绍了与黄金链接器链接的二进制文件运行速度更快吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用GEANT4(大型Monte Carlo C ++模拟框架,大量共享库)运行模拟代码.用黄金链接器和基于BFD的标准链接器编译并链接了GEANT和我的应用程序.看起来金币的运行速度要快一些(1'47与1'51").有人可以解释一下造成这种差异的原因是什么吗? Ubuntu 15.04、64位,GCC 4.9.2.每个测试运行大约10次,最短时间,没有其他活动,只需一个终端.

Running simulation code using GEANT4 (large Monte Carlo C++ simulation framework, lots of shared libraries). Compiled and linked GEANT and my app with gold linker and with standard BFD based linker. Looks like gold one is running a bit faster (1'47" vs 1'51"). Could someone shed a light what would be the reason for the difference? Ubuntu 15.04, 64bit, GCC 4.9.2. Run each test about 10 times, lowest time taken, no other activity, one terminal.

推荐答案

自然,不同的链接器会产生不同的结果,就像不同的编译器一样.结果主要取决于每个链接器上启用(和可用)的优化选项.这是您看到差异的一种可能原因,但可能还有许多其他原因:

Naturally, different linkers will produce different results, just like different compilers do. The result mostly depends on the optimization options that are enabled (and available) on each linker. Here is one possible reason for the differences you see, but there can be numerous others:

-fipa-icf

-fipa-icf

对函数和只读变量执行相同的代码折叠.优化会减小代码大小,并可能干扰展开 通过用不同的等效函数替换一个函数来堆叠 姓名.优化可以更有效地利用链接时间 启用优化.不过,行为类似于金 链接器ICF优化, GCC ICF在不同级别上工作,因此 优化并不相同-找到了等效项 仅由海湾合作委员会(GCC)和等效项由黄金(Gold)发现.

Perform Identical Code Folding for functions and read-only variables. The optimization reduces code size and may disturb unwind stacks by replacing a function by equivalent one with a different name. The optimization works more effectively with link time optimization enabled. Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF works on different levels and thus the optimizations are not same - there are equivalences that are found only by GCC and equivalences found only by Gold.

来自: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

最后但并非最不重要:除了实际的二进制内容外,还有许多环境因素会影响运行时.例如,缓存颠簸可能会对执行时间产生重大影响.而且,执行10次执行的结果对于统计结论来说太小了.

Last but not least: there are many environmental factors that can affect the runtime besides the actual binary content. E.g., cache thrashing can have a considerable effect on the execution time. Also, set of 10 executions is too small for statistical conclusions.

这篇关于与黄金链接器链接的二进制文件运行速度更快吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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