我用谷歌搜索了这个问题以弄清楚一些基本概念,但没有找到合适的答案。
在 Swift 编译器和 Apple LLVM (Objective-C) 的 Xcode build设置中,有多少优化级别可用于代码生成?
最佳答案
Swift 提供了四种不同的优化级别:
-Onone:
This is meant for normal development. It performs minimal optimizations and preserves all debug info.
-O:
This is meant for most production code. The compiler performs aggressive optimizations that can drastically change the type and amount of emitted code. Debug information will be emitted but will be lossy.
-未选中:
This is a special optimization mode meant for specific libraries or applications where one is willing to trade safety for performance. The compiler will remove all overflow checks as well as some implicit type checks. This is not intended to be used in general since it may result in undetected memory safety issues and integer overflows. Only use this if you have carefully reviewed that your code is safe with respect to integer overflow and type casts.
-Osize:
This is a special optimization mode where the compiler prioritizes code size over performance.
你可以在这里准备更多关于这些的信息:OptimizationTips
关于ios - Xcode 中的优化级别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57156601/