c - 支持链接时优化的技术和模式?

标签 c optimization

链接时优化 (LTO)(又名统一构建)包含在 GCC 4.5 或更高版本中,其他编译器也有类似的优化过程。这不会使某些代码模式比以前更可行吗?

例如,为了获得最佳性能,C 代码的“模块”通常需要公开其内容。 LTO 会让这个过时吗?哪些代码模式现在可行而以前不可行?

最佳答案

我相信 LTO 只是一种优化,但不一定是一种可以避免对任何模块的实现(“公开内容”)文档的需要的优化。为此目的编写了完整的语言;我认为 C 不会很快或永远不会消除这种需求。

来自 the description of the LTO feature in gcc :

Link Time Optimization (LTO) gives GCC the capability of dumping its internal representation (GIMPLE) to disk, so that all the different compilation units that make up a single executable can be optimized as a single module. This expands the scope of inter-procedural optimizations to encompass the whole program (or, rather, everything that is visible at link time).

From the announcement of LTO's inclusion into gcc :

The result should, in principle, execute faster but our IPA cost models are still not tweaked for LTO. We've seen speedups as well as slowdowns in benchmarks (see the LTO testers at http://gcc.opensuse.org/).

关于c - 支持链接时优化的技术和模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8023950/

相关文章:

c++ - 将 SVG 转换为光栅的 C/C 库。

c++ - 查找两个字符串中的共同字符

c - 使用 C 读取 linux 内核版本?

删除空白的 asp.net 发布

c++ - 需要帮助优化代码(最小图像约定)

python - FMUException : Error loading the binary. 无法加载 DLL:动态链接库 (DLL) 初始化例程失败

tensorflow - 是否有 L-BFGS 的 tf.keras.optimizers 实现?

创建一个函数来分配动态矩阵

Python:如何使机器学习预测在生产中运行得更快?

c - 以编程方式检索 infiniband 设备 ip 地址