64 位整数数学和按位运算基准

发布于 2024-09-12 12:01:54 字数 187 浏览 1 评论 0原文

我试图了解整数乘法与按位运算之间的性能差异...

我有两种作用于 64 位密钥的潜在哈希算法,一种使用单个乘法、单个右移和单个掩码,另一个涉及几个移位和掩码操作...但我想在实现之前尝试比较它们,因为弄清楚神奇的散列数需要一些时间才能弄清楚。

在典型的 64 位处理器上,每个 64 位整数乘法指​​令大约可以执行多少个位运算?

I'm trying to get a feel for the difference in performance between integer multiplication compared to bitwise operations...

I have two potential hashing algorithms acting on 64 bit keys, one which uses a single multiply, single right shift, and single mask, the other which involves several shift and mask operations... but I want to try and compare them before implementation since figuring out the magic hashing numbers will take some time to figure out.

On a typical 64 bit processor, approximately how many bitwise operations can execute per 64 bit integer multiplication instruction?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夏见 2024-09-19 12:01:54

http://lab.polygonal.de/2007 /05/10/bitwise-gems-fast-integer-math/

这给出了一般比较...没有指定 64 位或 32 位...但我将使用它作为基线。

http://lab.polygonal.de/2007/05/10/bitwise-gems-fast-integer-math/

This gives a general comparison... doesn't specify 64 bit or 32 bit... but I'll use this as a baseline.

看春风乍起 2024-09-19 12:01:54

也许每个乘法需要 10 位运算,但事情没那么简单。

您可以将两者叠加:在进行位运算时进行乘法。因此最快的解决方案可能是两者都做。

Maybe 10 bit operations per multiply, but it's not that simple.

You can overlay the two: do a multiplication while you do bit operations. So the fastest solution may involve doing both.

陌伤ぢ 2024-09-19 12:01:54

我建议阅读:http://www.intel.com/Assets/PDF/ Manual/248966.pdf

(短篇故事:有关针对英特尔处理器进行优化的 PDF。可能适合您的目的,非常接近一般情况)

I recommend reading: http://www.intel.com/Assets/PDF/manual/248966.pdf

(Short story: PDF about optimizing for Intel processors. Probably for your purposes very close to the general case)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文