Wednesday, February 28, 2018

Code Size Optimization Mode in Swift 4.1

Erik Eckstein:

We have seen that using -Osize reduces code size from 5% to even 30% for some projects.

But what about performance? This completely depends on the project. For most applications the performance hit with -Osize will be negligible, i.e. below 5%. But for performance sensitive code -O might still be the better choice.

[…]

But in contrast to -O, the compiler tries to avoid code duplication. For example, when inlining functions the compiler uses a lower size limit to decide whether a function should be inlined.

1 Comment RSS · Twitter


[…] Previously: Swift 4: Synthesizing Equatable and Hashable Conformance, Swift 4.1 Conditional Conformance Is Amazing, Code Size Optimization Mode in Swift 4.1. […]

Leave a Comment