-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Huge serialize performance degradation Carbon >= 2.61.0 #2787
Comments
Probably caused by |
Hello, I will inspect possible improvements, however, there is little chances that we can make it as good as before. Previously (in PHP 8.1) we was able to use the native serialization (so optimized C-coded algorithm from PHP itself). Since PHP 8.2 removed feature that broke the serialization, we have no choice but to rewrite it in PHP. Also being compatible with the last stable version of PHP is prior to optimization for older versions and I can't afford the maintenance burden to have different versions of the library for specific versions of PHP. |
Hi @kylekatarnls, can you explain what is exactly broken in the native serialization feature? This can help us in deciding how to manage the impact of this issue. |
You can remove $reflection = (new ReflectionClass(Carbon::class))->newInstanceWithoutConstructor();
@$reflection->date = '1990-01-17 10:28:07';
@$reflection->timezone_type = 3;
@$reflection->timezone = 'US/Pacific';
$date = unserialize(serialize($reflection)); IIRC, this was to support https://packagist.org/packages/opis/closure #2621. Because the code above works with However it sounds it's no longer possible with PHP 8.3 (even with raw Another point is that by default it will serialize only the |
Another pain point is that I just tried to remove it again to see if msgpack fixed the issue from their side. But I run into a segfault error (not sure if it's related): master...refactor/serialization (See the GitHub Actions result of the commit 8746237) I will add few tests to demonstrate the serialization steps that we want to stay backward-compatible, then the goal will be to have all the versions of PHP green. Only at this condition we could get rid of (completely or partially) of the |
msgpack 2.2.0 was released recently with the following fix.
Could this have fixed part of the issue? |
Very likely as locally all the tests are passing and the "debug" step in GitHub Actions is also passing. But I can't explain why it segfault in a test that sounds completely unrelated when we remove the Also there are 2 issues with PHP >= 8.2 that I got locally: |
I will inspect this issue using the debug built PHP at hand. Perhaps this is a bug in PHP itself. |
bug reported: php/php-src#11455 |
I think they won't handle it, they usually require to have a minimum reproducible case with raw PHP code, without library dependencies. |
Yes, I am trying to create a case to reproduce it at a minimum :) |
Hello, Since 2.61.0, Carbon seems to be causing significant performance degradation in the serialization and unserialization process.
This can be reproduced with the following code and commands
Carbon version: 2.60.0, 2.61.0 or later
PHP version: PHP 8.1.18
Thanks!
The text was updated successfully, but these errors were encountered: