64 位整数数学和按位运算基准
我试图了解整数乘法与按位运算之间的性能差异...
我有两种作用于 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
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.
也许每个乘法需要 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.
我建议阅读: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)