-
Notifications
You must be signed in to change notification settings - Fork 12
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
Crystal version #1
Comments
Cool!! I was likely gunna do one in Rust, but dunno how well others already perform. |
The benchmark for Crystal is pretty amazing:
Awesome! |
I saw that – very exciting :D |
Thanks to @skuznetsov, some optimizations have been made. We have achieved quite good results. bash-3.2$ ./benchmark
Crystal 0.33.0 (2020-02-14)
LLVM: 9.0.1
Default target: x86_64-apple-macosx
UUIX: 4.67M (213.98ns) (± 3.00%) 113B/op fastest
Crystal UUID: 783.57k ( 1.28µs) (± 2.15%) 0.0B/op 5.96× slower It would be great to see implementations in other languages. |
haha wow! That's a major jump! I just pushed some changes to this repo and it increased JS performance by ~200k op/s on my machine. I have a new "math" mode incoming that is not crypto-safe but is 1M op/s faster. |
I was able to achieve even more impressive speed on my MacBook:
This is with secure random buffer equal to 16MB and 1 byte shift (instead of original 16 as it is still unique and probability of generation of the same sequence is even less possible than with shift to 16) so it is quite good results with just 169 nanoseconds per one hash (including random data generation). |
That's awesome! Let me see if I understand correctly: You've modified this so that your window is inching along the pre-allocated Buffer 1 byte as a time (as opposed to a full chunk) 😂 That's so simple – great tweak! var BUFFER = '123456...';
uuid(); // => '123...';
uuid(); // => '234...';
uuid(); // => '345...'; |
Here are new numbers with that approach :)
|
Hope you don't mind that I've closed this @krthr – only because it's not an "issue" I really appreciate you porting this & sharing it! This is a first for me 🎉 |
I have written the Crystal version of this lib: https://github.com/krthr/uuix
The text was updated successfully, but these errors were encountered: