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

Time performance #1

Closed
moafred opened this issue Feb 9, 2018 · 1 comment
Closed

Time performance #1

moafred opened this issue Feb 9, 2018 · 1 comment

Comments

@moafred
Copy link

moafred commented Feb 9, 2018

Hey @fab2s, awesome work you just done here !

Can you share time performance benchmarks for generate SoUuid's vs Uuid's ?

@fab2s
Copy link
Owner

fab2s commented Feb 9, 2018

Sure thing ;-)

UUID generation benchmark :

This is pure generation benchmark, so it's not entirely honest since all implementations do not do exactly the same thing upon generation. For example Webpatser/Uuid does pre-compute the string representation after having generated the binary form. SoUuid lazy generates string and Hex forms, so this work is done after, but, if you consider that the whole point of doing this is to optimize inserts, hence to use the binary form, then, SoUuid has no overhead to provide with the binary form as it is the root form.
Then, Ramsey/Uuid is kind of over engineered for the sole purpose of generation, so it's not a surprise that it is slower.

No need to say that if the differences are pretty significant, we are still talking about winning at best one sec per million UUIDs, so it's clear that the actual optimization is not here, but in the massive insert, see benchmarks here https://www.percona.com/blog/2014/12/19/store-uuid-optimized-way/

Benchmarking fab2s/SoUuid vs Ramsey/Uuid vs Webpatser/Uuid                          
Iterations: 100 000                                                               
Averaged over: 10                                                                 
PHP 7.1.2 (cli) (built: Feb 14 2017 21:24:45) ( NTS MSVC14 (Visual C++ 2015) x64 )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
Windows NT xxxxx 10.0 build 16299 (Windows 10) AMD64                                                  
+----------------+----------+-----------+---------+
| Generator      | Time (s) | Delta (s) | %       |
+----------------+----------+-----------+---------+
| fab2s/SoUuid   | 0.4533   |           |         |
| Webpatser/Uuid | 0.9050   | 0.4517    | 99.63%  |
| Ramsey/Uuid    | 1.5755   | 1.1221    | 247.52% |
+----------------+----------+-----------+---------+

Will commit the bench, it may not be working yet on PHP below 7 as I don't have any <7.0 64 bit version ATM thus cannot test.

@fab2s fab2s closed this as completed in 04d653e Feb 9, 2018
@fab2s fab2s reopened this Feb 9, 2018
@fab2s fab2s closed this as completed Feb 9, 2018
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

2 participants