TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Benchmark Comparison of Python Hashing Functions

10 pointsby zacwitteover 12 years ago

3 comments

reaperhulkover 12 years ago
I'm unsure of the value of benchmarks of hash function performance when you aren't defining what you need the hash function for. Python's built-in hash function is not designed to do the same things that the SHA family is.
otover 12 years ago
The timings for hash() are meaningless, since Python's str object caches the hash after the first call [1]. FNV is one of the fastest hash functions, it should be at least suspicious that hash() is 500 times faster than FNV.<p>[1] <a href="http://hg.python.org/releasing/2.7.3/file/7bb96963d067/Objects/stringobject.c#l1266" rel="nofollow">http://hg.python.org/releasing/2.7.3/file/7bb96963d067/Objec...</a>
jdavidover 12 years ago
MD5/ SHA is designed to be slow. so it makes sense that one that is optimized to be chaotic, low collision probability and even distribution could be faster.