2 ms·
> Not an apples-to-apples comparison. These kinds of arguments make sense if you're 20% different, or 2x different, or even 10x different. When you're 1000x d
by haberman 15y ago
> Not an apples-to-apples comparison.
These kinds of arguments make sense if you're 20% different, or 2x different, or even 10x different. When you're 1000x different, no amount of minor tweaking is going to bridge the gap.
Using the 4k version and using timeit() instead of range(), the speed is 21 seconds instead of 32 seconds, so it did speed up, but it's still 800x slower. I'm pretty sure that only a tiny fraction of Python's time is calculating sha224, so I don't think that making them use the same hash function is necessary.
Look, Python is cool and has it's place. But it's annoying to get downvoted for stating the obvious: algorithms like this will be much, much faster in C. It's annoying to hear people insist that dropping to C is a waste of time when my personal experience shows time and time again that it can lead to drastic improvements.