SHA256Managed 在 x64 构建中快两倍 - 这是典型的吗? [英] SHA256Managed twice as fast in x64 builds - is this typical?

查看:25
本文介绍了SHA256Managed 在 x64 构建中快两倍 - 这是典型的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据说可以在 x86 模式下编译 .NET 应用程序,因为几乎 x64 提供的唯一好处是更大的虚拟地址空间,从而允许应用程序分配超过 2(或 3)GB 的内存,或整个内存映射非常大的文件.

It has been said it's OK for a .NET application to be compiled in x86 mode because pretty much the only benefit x64 gives is a larger virtual address space, thus allowing the application to allocate more than 2 (or 3) GB of memory, or memory-map very large files in their entirety.

但是,一个非常简单的测试表明,在 64 位机器上,如果应用程序是 x86,SHA256Managed 对 10MB 字节数组的散列速度几乎是 x64 的两倍.因此,任何执行大量 SHA256 散列的应用程序都可以从任何 CPU"或为两个平台单独构建中获得相当大的好处.

However, a very simple test indicates that on a 64-bit machine, SHA256Managed hashes a 10 MB byte array almost twice as slowly if the application is x86 than if it is x64. So, any application that does a lot of SHA256 hashing benefits rather significantly from being "Any CPU" or having separate builds for the two platforms.

我的问题是:这是 .NET 的典型结果吗?在 64 位操作系统上以 64 位模式运行时,其他计算量大的任务是否同样受益?当然,我可以只测试每一个特定的计算,但我希望有一个整体的经验法则",例如:

My question is: is this a typical result for .NET? Do other computationally-heavy tasks benefit similarly from running in 64-bit mode on a 64-bit OS? Of course, I could just test every specific computation, but I'd appreciate an overall "rule of thumb", such as:

  • 是的,任何进行大量整数运算的东西都会更快
  • 是的,所有数值计算都快得多(包括双精度/小数)
  • 不,这是一个罕见的例外,大多数算法在两种模式下的运行速度大致相同

推荐答案

如前所述,答案很复杂,很大程度上取决于您在做什么.相关问题:

As mentioned the answer is complex and depends highly on what you are doing. Related questions:

这篇关于SHA256Managed 在 x64 构建中快两倍 - 这是典型的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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