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

Use SecureRandom.uuid instead of UUID4R.uuid(4) #50

Closed
atrzaska opened this issue Oct 1, 2018 · 0 comments
Closed

Use SecureRandom.uuid instead of UUID4R.uuid(4) #50

atrzaska opened this issue Oct 1, 2018 · 0 comments

Comments

@atrzaska
Copy link
Contributor

atrzaska commented Oct 1, 2018

Problem

Currently beetle uses UUID4R gem for generating message UUID.
UUID4R gem uses OSSP-UUID native library.
OSSP-UUID library is outdated (2008). It is also not included as package in many linux distributions.
Therefore many times developers are stuck installing this library by compiling from the source.

Proposal

Replace UUID4R gem with SecureRandom.

Speed benchmark

SecureRandom seems like a 4 times faster solution than UUID4R:

[4] pry(main)> Benchmark.bmbm(100) { |b| b.report('SecureRandom.uuid') { SecureRandom.uuid }; b.report('UUID4R::uuid(4)') { UUID4R::uuid(4) } }
Rehearsal ----------------------------------------------------------------------------------------------------------------------------------------
SecureRandom.uuid                                                                                      0.000037   0.000004   0.000041 (  0.000034)
UUID4R::uuid(4)                                                                                        0.000032   0.000112   0.000144 (  0.000144)
------------------------------------------------------------------------------------------------------------------------------- total: 0.000185sec

                                                                                                           user     system      total        real
SecureRandom.uuid                                                                                      0.000029   0.000003   0.000032 (  0.000027)
UUID4R::uuid(4)                                                                                        0.000030   0.000078   0.000108 (  0.000103)
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

No branches or pull requests

1 participant