-
-
Notifications
You must be signed in to change notification settings - Fork 451
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 PECL uuid function #937
Conversation
I'm fine with this, the leaner the better. I am wondering why you have chosen for Also the build is failing because you left some |
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.
Change looks good to me, the only thing I see from the announcement of this polyfill is that:
- for a v4 UUID the PECL extension is 3.25x slower than the polyfill while Ramsey is 1.30x slower
- the difference of time between the polyfill and Ramsey is not so big, while it is for the PECL extension (the PECL extension is the slowest while generating v4 UUIDs)
That is interesting... it seems like The polyfill itself is even faster but it looks like with the PECL extension you get a big downgrade in performance (comparing against Overal it might be better to keep Good find (by @ste93cry) on the announcement, did not even question the "extension is faster" statement: https://symfony.com/blog/introducing-the-new-symfony-uuid-polyfill Even more info here: https://jolicode.com/blog/uuid-generation-in-php |
Ramsey can use the PECL extension too, however by default its usage is disabled and must be manually enabled, even if it's available. Also I don't know how much this extension is installed, so I cannot comment on it. The downside of this change is that the polyfill automatically uses it if it finds that it's available and there is no way to prevent it |
I agree, so if the consideration to make this change is speed I think this is going backwards when the PECL extension is actually installed and only slightly better if it's not :) As far as I've gathered the PECL extension might be more secure/resistent to collisions since it uses a better random source, but that is not critically important in this case. |
Ramsey should use the https://jolicode.com/blog/uuid-generation-in-php Given that this change is just an internal change and doesn't affect in any way the public API it makes sense in my opinion to merge it and accept the tradeoffs of slowing things down if the extension is enabled because I doubt that such extension is so commonly used |
Thank for your review and comments. Yes PECL, is 3 micro seconds slower than Ramsey/polyfill. The purpose of this PR was more about removing a dependency to a package (that already have 3 major version and a 4th in dev) and removing the burdon of maintaing/updating the dependency while keep Backward Compatibility with old version. Feel free to close the PR if you think we won't affort such performance drawback, I wouldn't be offended 😉 |
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.
Given that this change is just an internal change and doesn't affect in any way the public API it makes sense in my opinion to merge it and accept the tradeoffs of slowing things down if the extension is enabled because I doubt that such extension is so commonly used
This is a good point @ste93cry, in that case i'm also down for this!
Edit: I've upped the dependent version of the polyfill because symfony/polyfill#209
As I already said, I'm more than happy to drop a dependency if we can and it makes sense and in this case for what we are doing which is just generating a UUID and then converting it to a |
I've made the change on the test class (for the |
tests are green. (sorry @stayallive i force-pushed you commit). Looks like Appveyor is out |
I'm looking at the issue, since PHP 7.1 is not maintained anymore the link to download the Windows version is not working anymore 🤦♂ |
@jderusse looks like everything is here so no worries :) Just some AppVeyor issues, but the PR is solid, thanks! |
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.
Very good job everyone, this PR is pretty solid! Let's hope to fix AppVeyor ASAP... Maybe we can look at how Symfony fixed its build?
@jderusse can you please force push to retrigger the CI? Once all checks are green I will merge |
Yes sorry my bad, I didn't notice it! I will rebase |
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.
LGTM, thank you for the hard work
This PR replaces the RamserUUID object
uuid_create
.Calls to the PECL library are faster and avoid storing complexe object for nothing.