ios - Xcode 中的优化级别

标签 ios objective-c swift xcode optimization

我用谷歌搜索了这个问题以弄清楚一些基本概念,但没有找到合适的答案。

在 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/

相关文章:

objective-c - 使用从 UIImagePickerController 保存的图像进行内存管理

ios - 如何获取从 subview 添加 subview 的 UIViewController?

swift - Xcode 错误 : Argument passed to call that takes no arguments

iphone - 如何在打开应用程序时将第一个 viewController 屏幕设置为默认打开屏幕

ios - 我应该使用 beginBackgroundTaskWithExpirationHandler : for all HTTP connections?

ios - 类似于 CGPoint 的类,但带有整数(用于表示网格中的位置)

ios - Xcode 6 iOS 7 View 大小

ios - 如何将 LittleEndian Pitch Detector SDK 添加到 Xcode?

ios - 没有参数的函数调用错误中缺少参数 #1 的参数。 swift

ios - 如何追加数组。或者我如何将模型转换为 nsmuttable 数组