在 Xcode 中编译 i386 和 x86_64 的区别? [英] Differences between compiling for i386 vs x86_64 in Xcode?

查看:36
本文介绍了在 Xcode 中编译 i386 和 x86_64 的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Active Architecture 设置为 i386 和 x86_64(在主窗口左上角的下拉菜单中选择)的情况下,在 Xcode 中编译 Mac 应用程序有什么区别?在项目的构建设置中,架构选项为标准(32/64 位通用)、32 位通用和 64 位英特尔.实际上,这些是什么意思以及如何决定?

What are the differences between compiling a Mac app in Xcode with the Active Architecture set to i386 vs x86_64 (chosen in the drop down at the top left of the main window)? In the Build settings for the project, the Architecture options are Standard (32/64-bit Universal), 32-bit Universal, and 64-bit Intel. Practically, what do these mean and how does one decide?

假设一个目标是 OS X 10.5 及更高版本.我在活动监视器中看到,针对 x86_64 进行编译会导致应用程序使用的内存比针对 i386 编译的应用程序更多.有什么好处?我知道 64 位是未来",但考虑到更高的内存使用量,选择 32 位是否有意义?

Assume one is targeting OS X 10.5 and above. I see in the Activity Monitor that compiling for x86_64 results in an app that uses more memory than one compiled for i386. What is the advantage? I know 64-bit is "the future", but given the higher memory usage, would it make sense to choose 32-bit ever?

推荐答案

32/64-bit Universal -- i386, x86_64, ppc

32/64-bit Universal -- i386, x86_64, ppc

32 位通用 -- i386,ppc

32-bit Universal -- i386, ppc

64 位英特尔 -- 仅限 64 位英特尔

64-bit Intel -- 64 bit Intel only

不再支持 ppc64.

ppc64 is no longer supported.

x86_64 二进制文件速度更快,原因有很多;更快的 ABI,更多的寄存器,在许多(大多数和所有新机器)机器上,内核是 64 位的内核调用速度更快,等等等等...

x86_64 binaries are faster for a number of reasons; faster ABI, more registers, on many (most & all new machines) machines the kernel is 64 bit & kernel calls are faster, etc.etc.etc...

虽然 64 位的内存开销有一些直接相关,但通常与应用程序数据结构的指针重量直接相关,但请记住,32 位应用程序会拖累所有框架的 32 位版本.如果您的应用程序是系统上唯一的 32 位应用程序,与 64 位版本相比,它会产生大量的开销.

While 64 bit has a bit of memory overhead directly related, generally, to how pointer heavy your app's data structures are, keep in mind that 32 bit applications drag in the 32 bit versions of all frameworks. If yours is the only 32 bit app on the system, it is going to incur a massive amount of overhead compare to the 64 bit version.

64 位应用程序还享受最新最好的 Objective-C ABI;合成的 ivars、非脆弱的 ivars、统一的 C++/ObjC 异常、零成本的 @try 块等......还有许多优化也只能在 64 位中实现.

64 bit apps also enjoy the latest and greatest Objective-C ABI; synthesized ivars, non-fragile ivars, unified C++/ObjC exceptions, zero-cost @try blocks etc... and there are a number of optimizations that are only possible in 64 bit, too.

这篇关于在 Xcode 中编译 i386 和 x86_64 的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆