问题描述
我想我是集中在x86,但我一般从32到64感兴趣的举动位。
在逻辑上,我可以看到,常量和指针,在有些情况下,将更大所以方案可能是更大的。而分配内存的效率字边界的愿望将意味着分配之间的多个空白。
我还听说,在x86 32位模式有刷新其时的上下文切换,由于可能的重叠4G地址空间的缓存。
那么,什么是64真正的实惠位?
而作为一个补充问题,将128位是更好?
编辑:
我刚才写我的第一个32/64位程序。这使得链表/ 16字节(32B型)或32字节的树(64B版)对象,并做了很多印刷标准错误 - 不是一个真正有用的程序,而不是典型的,但它是我的第一次。
尺寸:81128(32B)诉83672(64B) - 所以没有太大的区别。
速度:17S(32B)诉24S(64B) - 在32位操作系统上运行(OS-X 10.5.8)
更新:
我注意到一个新的混合X32 ABI(应用程序二进制接口)目前正在开发的是64B,但使用32b的指针。对于某些测试中,它会导致小code和更快的执行速度比任何32B或64B。
https://sites.google.com/site/x32abi/
除非你需要访问更多的内存寻址32b的让你的收益将很小,如果有的话。
在64B CPU运行时,你,如果你正在运行32B或64B code(您使用的是相同的缓存和同一总线),得到相同的显存位宽,无论
虽然x64体系结构有几个更多的寄存器,它允许更容易的优化,这通常是由以下事实指针抵消成为较大,并利用具有指针导致较高的存储器流量的任何结构。我估计的增加的总的内存使用一个64b的应用相比,32b的一到大约15-30%。
I suppose I am focussing on x86, but I am generally interested in the move from 32 to 64 bit.
Logically, I can see that constants and pointers, in some cases, will be larger so programs are likely to be larger. And the desire to allocate memory on word boundaries for efficiency would mean more white-space between allocations.
I have also heard that 32 bit mode on the x86 has to flush its cache when context switching due to possible overlapping 4G address spaces.
So, what are the real benefits of 64 bit?
And as a supplementary question, would 128 bit be even better?
Edit:
I have just written my first 32/64 bit program. It makes linked lists/trees of 16 byte (32b version) or 32 byte (64b version) objects and does a lot of printing to stderr - not a really useful program, and not something typical, but it is my first.
Size: 81128(32b) v 83672(64b) - so not much difference
Speed: 17s(32b) v 24s(64b) - running on 32 bit OS (OS-X 10.5.8)
Update:
I note that a new hybrid x32 ABI (Application Binary Interface) is being developed that is 64b but uses 32b pointers. For some tests it results in smaller code and faster execution than either 32b or 64b.
https://sites.google.com/site/x32abi/
Unless you need to access more memory that 32b addressing will allow you, the benefits will be small, if any.
When running on 64b CPU, you get the same memory interface no matter if you are running 32b or 64b code (you are using the same cache and same BUS).
While x64 architecture has a few more registers which allows easier optimizations, this is often counteracted by the fact pointers are now larger and using any structures with pointers results in a higher memory traffic. I would estimate the increase in the overall memory usage for a 64b application compared to a 32b one to be around 15-30 %.
这篇关于64位程序更大,比32位版本更快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!