Apple LLVM 8.0 - Code Generation
部分下的Unroll Loops
优化设置似乎在最新的 XCode 8.2.1 中默认关闭,即使对于发布
配置。有什么好的理由吗?我认为循环展开是最基本的优化之一。
最佳答案
似乎禁用它是为了避免增加生成代码的大小。
Tuning for Performance and Responsiveness
Table 6-1 Compiler optimization options
Faster
The compiler performs nearly all supported optimizations that do not require a space-time tradeoff. The compiler does not perform loop unrolling or function inlining with this option. This option increases both compilation time and the performance of generated code.
Fastest
The compiler performs all optimizations in an attempt to improve the speed of the generated code. This option can increase the size of generated code as the compiler performs aggressive inlining of functions. This option is generally not recommended.
关于c++ - 为什么在 XCode 中默认情况下循环展开?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41854437/