3 ms·
I'm always amazed about how well naive Unix solutions measure up compared to contemporary solutions. For instance, the non-indexed python solution here takes a
by johnklos 4y ago
I'm always amazed about how well naive Unix solutions measure up compared to contemporary solutions. For instance, the non-indexed python solution here takes a little more time than the Unix look command (Pi 4):
time pwned.sh password
5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8:9545824
0.053u 0.035s 0:00.40 20.0% 83+22k 35+0io 21pf+0w
time python3.10 02-binary-search.py pwned-passwords-sha1-ordered-by-hash-v8.txt password
looking for 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8
pwned! seen 9,545,824 times before
in 0.090021 seconds
0.105u 0.013s 0:00.44 25.0% 0+3k 32+0io 4pf+0w
Obviously, if you're doing millions of lookups you'll want indexing, but otherwise using built-in tools that have been optimized and refined for decades does very well.
- deleted 4y ago[deleted]