Skip to content

Instantly share code, notes, and snippets.

@madewulf
Last active October 7, 2020 12:40
Show Gist options
  • Save madewulf/6844cef0d23f0a895051472e71355102 to your computer and use it in GitHub Desktop.
Save madewulf/6844cef0d23f0a895051472e71355102 to your computer and use it in GitHub Desktop.
Set performance test (less than 10 seconds on my Mac)
from uuid import uuid4
s = set()
for i in range (500000):
s.add(str(uuid4()))
count = 0
for uu in s:
if uu in s:
count += 1
print(count)
if "other_string" not in s:
print("this is normal")
@madewulf
Copy link
Author

madewulf commented Oct 7, 2020

This generates a set of 500 000 random strings and then test if each one is in the set. It takes less than 10 seconds on my Mac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment