Skip to content

Instantly share code, notes, and snippets.

@M0r13n
Created February 20, 2020 11:06
Show Gist options
  • Save M0r13n/2cd2e26f4901796c898e2491ca840c98 to your computer and use it in GitHub Desktop.
Save M0r13n/2cd2e26f4901796c898e2491ca840c98 to your computer and use it in GitHub Desktop.
Python caches hashes of strings
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