2013-02-21 40 views
4

我只是想雜音哈希C#端口慢...爲什麼雜音比內置的MD5/SHA1方法

但是我對其性能很失望。它似乎比內置的C#MD5/SHA1 computeHash方法慢。

調試模式很好,在此模式下雜音較快。如果切換到釋放模式,它比SHA1或MD5哈希方法更慢。

+3

哪一個實現?例如,試試這個 - http://blog.teamleadnet.com/2012/08/murmurhash3-ultra-fast-hash-algorithm.html – 2013-02-21 20:26:13

+1

你是否有個人資料?結果是什麼? – driis 2013-02-21 20:30:20

+0

如果性能是一個問題,那麼最好使用非託管C++和P/Invoke實現,或者使用C++/CLI中的IJW – 2013-02-21 20:58:52

回答

2

我找到了原因,就應該設置爲64或anycpu,而不是86

這裏的測試結果。

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 

SOURE代碼:

https://github.com/arisoyang/Murmur3Hash

相關問題