IOS – 64bit vs 32bit on mobile devices with 2gb ram – is there any sense


Today I took part in an interesting discussion. Someone said that's great that Apple goes 64bit with their iPhone 5S. Of course I mentioned about no need for 64bits paired with 2 gigs of RAM, but then I started to wonder – is there anything good with 64bit in this case, except for benefits of "future compatibility"? Larger instructions? Any kind of optimalization?

Best Answer

Since the iPhone doesn't use an x86 processor, almost everything you know about 64-bit versus 32-bit will not apply. For example, on x86 processors, more general purpose registers are available in 64-bit mode. This provides a performance boost in 64-bit mode. That doesn't apply to non-x86 processors.

64-bit operation tends to provide benefits to software that handles "bulk data". This generally includes things like encryption, compression, and image processing. Other types of programming don't significantly benefit because they seldom deal with values that occupy more than 32-bits. Also, more memory bandwidth is required by 64-bit code because all pointers are twice as large and this can cause some performance loss.

However, there is one big advantage of 64-bit code over 32-bit code -- virtual memory need not be treated as a scarce resource. This can have all kinds of benefits both for performance, ease of development, reliability, maintainability, and so on. For example, if you're manipulating a large database file, you can memory-map the entire file and access it just like an array. This can eliminate a lot of slow, complex, error-prone code to memory map sections of the file or alternate seeks with data operations.

Similarly, libraries can have fixed virtual addresses. This can improve code sharing and result in memory being used more effectively. It can minimize relocation, which can result in faster code startup.

To be honest, you would have to know a lot about the internals of how the device operates, both in software and in hardware, to usefully opine on whether a change from a 32-bit platform to a 64-bit platform will provide significant benefits.