-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Support for custom character length alphabets #59
Support for custom character length alphabets #59
Conversation
Changed
Previous attempt in #51 didn't find any success, because it used
|
Added some more benchmarks, |
I think we can just raise the minimum version in Line 5 in d3d4af7
|
seems like I was a bit mistaken, and And no clue why CI lint is failing, have to investigate |
Introduced more encode optimizations, using similar technique as used in |
Increasing to 1.21 is fine 🙂 |
encoder.go
Outdated
if err != nil { | ||
return | ||
} | ||
if e.alphabet.len == defaultBase { // compiler optimization using constant for default base |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, is it worth it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on Decode
it's around ~11% performance difference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just ran benchmarks on Decode
again, and it seems like there was some fluke in the first run.
And it seems like removing this if
actually improves performance by ~2%.
Removed it.
Added benchmarks for NewWithNamespace.
|
Thanks! Very impressive work again! 👏 |
Are you planning on doing more of these or...? |
Thanks again for very quick review and approval!
I think I did all I could already. =) I just noticed that this library (we used v3) was major part of our cpu usage on production. |
Well I'm glad you took your time. The improvements are quite significant! Always nice to hear from people using it in production 🙂 New release: https://github.com/lithammer/shortuuid/releases/tag/v4.2.0 |
resolve Support for custom character length alphabets #39
(compatible with python's shortuuid custom len alphabets)
resolve panic on more than 1 byte symbols #60
Improved performance: