c++ - Visual Studio中/GL和/LTCG有什么区别

标签 c++ c visual-studio hyperlink

我试着在网上寻找不同之处,但一无所获。这两个选项听起来相互关联:

/LTCG:https://msdn.microsoft.com/en-us/library/xbf3tbeh.aspx

The /LTCG option tells the linker to call the compiler and perform whole-program optimization.

/总帐:https://msdn.microsoft.com/en-us/library/0zza0de8.aspx

Enables whole program optimization.

有人知道确切的区别吗?

最佳答案

/GL 是编译器选项,/LTCG 是链接器选项。根据文档,它们彼此密切相关。例如:

/LTCG is implied with /GL

但是,/LTCG 可以在不使用 /GL 的情况下使用。

The /LTCG option tells the linker to call the compiler and perform whole-program optimization. You can also do profile guided optimization.

如何启用配置文件引导优化?通过使用 /GL 选项。

/GL also makes profile guided optimization available; see /LTCG

什么是配置文件引导优化?这是 profile guided optimization documentation 开头的片段:

Profile-guided optimization lets you optimize an output file, where the optimizer uses data from test runs of the .exe or .dll file. The data represents how the program is likely to perform in a production environment.

关于c++ - Visual Studio中/GL和/LTCG有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35471658/

相关文章:

C++ 约束 enable_if 与 requires

c++ - 每当我调试时出现几个错误

c - 使用 scanf 函数运行 for 循环的正确方法是什么

C代码输出困惑

C编译: collect2: error: ld returned 1 exit status

visual-studio - 如何在Ms cobol 2.20中调试

visual-studio - Visual Studio (MASM) 程序集 - 为什么即使未调用标签,标签中的代码也会自动执行

c++ - 是否可以在 C++ 中创建对象数组队列?

C++ 对象 vector

c++ - 什么时候可以安全且轻松地将引用变量用作别名?