iPhone compile for thumb

后端 未结 4 2221
一整个雨季
一整个雨季 2021-02-15 13:43

I\'ve heard it might be a good idea to turn off \"compile for thumb\" in an iPhone target\'s settings to increase performance. I\'m having some trouble finding this setting thou

相关标签:
4条回答
  • 2021-02-15 14:26

    The standard instruction set for ARM is 4-bytes. Using "Compile for Thumb", the compiler is able to use 2-byte instructions. This results in a much smaller library, but also a slower one (somewhat debatable). More critically, there are issues with running under ARMv6. In our case, we could not generate stable output from Monotouch (fix in MT4.0 alpha). In Xcode, you can find the setting by clicking on your Target, and looking under Build and searching for "thumb". Mine is under GCC 4.2 - Code Generation, but sometimes it is under LVVM GCC 4.2.

    Compile for Thumb

    0 讨论(0)
  • 2021-02-15 14:27

    "Compile for Thumb" should be under Target/Get Info/GCC 4.2 - Code Generation. If it's not there (I'd be surprised if it's not), set the user-defined variable.

    Keep in mind that this improves performance only under a narrow set of circumstances that you should understand before fiddling with it.

    0 讨论(0)
  • 2021-02-15 14:28

    I've found that the compiler settings ("GCC 4.2 - Code Generation", "GCC 4.2 - Language", etc) only show up in the Target info build settings window when the Active SDK is set to Device -- and the "User-defined" category only shows up when the Active SDK is Simulator.

    And yes, disabling Thumb compilation can be a big help to performance if you're dealing with lots of floating point math (e.g. floating-point audio processing). Though it's not, of course, an all-purpose magical speed-up (and supposedly Thumb-compiled code can run faster in some situations), so you'll probably only find disabling Thumb useful if your code has that kind of bottleneck.

    0 讨论(0)
  • 2021-02-15 14:39

    GCC_THUMB_SUPPORT is the right variable. Just set it to NO to disable THUMB code generation.
    A general rule of THUMB is, to disable it if your code is floating point heavy :)
    More about that here.

    Update:
    The advice to compile for the THUMB instruction set is no longer valid (actually since the iPhone 3GS).

    0 讨论(0)
提交回复
热议问题