c++ - 为什么在 XCode 中默认情况下循环展开?

标签 c++ xcode optimization clang loop-unrolling

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/

相关文章:

xcode - xcodebuild存档:设置版本号和内部版本号

c++ - 循环地址对齐如何影响 Intel x86_64 上的速度?

iphone - 保持 ViewController 处于相同状态/保持它在后台加载?

ios - 从组文件夹中获取所有文件?

sql-server - 为什么索引在此联接(SQL Server 2008R2)中似乎没有帮助?

android - 在 Android 上使用 OrmLite 进行 Proguard

C++ 重载取消引用运算符

c++ - 搜索整数子串的超快速方法

c++ - 我不明白使用sse的代码在哪里有问题

c++ - C++ 中的简单序列化示例