XCode, LLVM and Code Optimizations - Fastest, Smallest vs. None

There are very good SO descriptions and also all over the world on how LLVM optimizes code. But they cannot answer my specific question.

Xcode has various options for optimizing the code in the project and target settings. I understand the need for optimization at design time, but why not choose anything other than a build assembly when choosing an assembly Fastest,Smallest[-Os]

.

+3


source to share


1 answer


In most situations, -O is a good choice. It has a nice combination of space optimization and speed optimization.

However, other options have some appeal:



  • -O / -O1: "I would like to have a little more options for debugging the optimized code"
  • -O2: (ok, honestly don't know why one would choose -O2 over-O. Maybe if a certain optimization of the code size? Performance is too much?)
  • -O3: "This piece of code should be quick and respond well enough to aggressive inlay and looping to offset the code size penalty."
+3


source







All Articles