Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: increase performance up to 10x on exists string to uuid, 2x for new. #145

Merged
merged 2 commits into from
Feb 10, 2024

Conversation

magicbear
Copy link
Contributor

@magicbear magicbear commented Feb 10, 2024

def perf_new():
t1 = time.time()
for i in range(10000000):
s=str(UUID(b'\xbc\x99\xfe\xf6{\x0bLO\x8en\xe8\xb4\x1aC;5'))
print(1000*(time.time()-t1))

def perf_exists():
t1 = time.time()
uuids = UUID(b'\xbc\x99\xfe\xf6{\x0bLO\x8en\xe8\xb4\x1aC;5')
for i in range(10000000):
s=str(uuids)
print(1000*(time.time()-t1))

perf_exists()
Old -> 2681.8525791168213
New -> 277.8770923614502

perf_new()
Old -> 11315.203666687012
New -> 6226.833820343018

increase performance up to 10x on exists string to uuid, 2x for new.
reduce some performance for hash, but can be use just string to match in dict, just hash as UUID string

@magicbear magicbear changed the title feat: for easier usage on dict hashing feat: increase performance up to 10x on exists string to uuid, 2x for new. Feb 10, 2024
@cheahjs cheahjs merged commit 349e8e7 into cheahjs:main Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants