gpt4 book ai didi

c# - 为什么杂音比内置的 MD5/SHA1 方法慢

转载 作者:行者123 更新时间:2023-11-30 12:30:56 24 4
gpt4 key购买 nike

我刚刚尝试了 murmur hash C# 端口...

然而,我对它的表现感到非常失望。它似乎比内置的 C# MD5/SHA1 computeHash 方法慢。

Debug模式很好,在这种模式下杂音更快。如果切换到 Release 模式,它比 SHA1 或 MD5 哈希方法慢。

最佳答案

我找到原因了,它应该设置为 x64 或 anycpu 而不是 x86

这是测试结果。

Release - Target AnyCPU


Murmur Hash profile...
test Bytes :2621440000
iterations :10000
totalSeconds :**1.787**
bytesPerSecond :1466950195.85898
mbitsPerSecond :1398.99272523783





BuildinSHA Hash profile...
test Bytes :2621440000
iterations :10000
totalSeconds :**5.956**
bytesPerSecond :440134318.334453
mbitsPerSecond :419.74479516454

Release - Target X86

Murmur Hash profile...
test Bytes :2621440000
iterations :10000
totalSeconds :10.612
bytesPerSecond :247026008.292499
mbitsPerSecond :235.582359592914


BuildinSHA Hash profile...
test Bytes :2621440000
iterations :10000
totalSeconds :5.987
bytesPerSecond :437855353.265408
mbitsPerSecond :417.571404710205

Release - Target X64



Murmur Hash profile...
test Bytes :2621440000
iterations :10000
totalSeconds :1.732
bytesPerSecond :1513533487.29792
mbitsPerSecond :1443.41801385681


BuildinSHA Hash profile...
test Bytes :2621440000
iterations :10000
totalSeconds :5.968
bytesPerSecond :439249329.758713
mbitsPerSecond :418.900804289544

源代码:

https://github.com/arisoyang/Murmur3Hash

关于c# - 为什么杂音比内置的 MD5/SHA1 方法慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15011523/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com