Created
January 4, 2019 11:06
-
-
Save gmarkall/ea1995c4257a9e9d188544dddb6045b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import hashlib | |
| d = {} | |
| for i in range(1200000): | |
| k = hashlib.md5('%x' % i).digest() | |
| d[k] = i | |
| #for k in d.keys(): | |
| # print k | |
| print hashlib.md5('%x' % 999999).digest() in d.keys() | |
| print hashlib.md5('%x' % 999999).digest() in d | |
| print hashlib.md5('%x' % 1200001).digest() in d.keys() | |
| print hashlib.md5('%x' % 1200001).digest() in d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 0 graham@gm-x220 11:05:54 ~/tmp/pypy | |
| $ time pypy dtest.py | |
| True | |
| True | |
| False | |
| False | |
| real 0m3.099s | |
| user 0m2.913s | |
| sys 0m0.158s | |
| 0 graham@gm-x220 11:06:03 ~/tmp/pypy | |
| $ time python dtest.py | |
| True | |
| True | |
| False | |
| False | |
| real 0m2.584s | |
| user 0m2.463s | |
| sys 0m0.104s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment