Created
February 20, 2020 11:06
-
-
Save M0r13n/2cd2e26f4901796c898e2491ca840c98 to your computer and use it in GitHub Desktop.
Python caches hashes of strings
This file contains 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
data = "ABCDEFG1234" * 1000000000 | |
x = lambda: hash(data) | |
import timeit | |
for i in range(10): | |
print(f"#{i} took {timeit.timeit(x, number=1)} secs") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment