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

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

问题描述

使用Active Architecture设置为i386 vs 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位通用-i386,x86_64,ppc

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

32位通用-i386,ppc

32-bit Universal -- i386, ppc

64位Intel-仅64位Intel

64-bit Intel -- 64 bit Intel only

ppc64不再受支持。

ppc64 is no longer supported.

x86_64二进制文件由于多种原因而速度更快;在许多(大多数新机器)的机器上,内核为64位&速度更快的ABI,更多的寄存器。内核调用速度更快,等等等等。

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天全站免登陆