64位程序更大,比32位版本更快?

编程入门 行业动态 更新时间:2024-10-24 15:15:27
本文介绍了64位程序更大,比32位版本更快?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想我是集中在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。

sites.google/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.

sites.google/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位版本更快?

本文发布于:2023-07-05 09:02:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1035508.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:更大   更快   版本   程序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!