Open dktapps opened 3 years ago
Could this be related to https://github.com/pmmp/pthreads/issues/63 ?
This isn't a bug report, so it's not related that way, no. I have no idea what's behind #63 since I haven't investigated it yet.
Alright thanks for updating, just considering the possibitily of having to copy classes causing an extra delay in Pool::Submit , which seems to be aligned with the https://github.com/pmmp/pthreads/issues/63 issue disappearing when opcache cli is enabled .
Currently, pthreads makes copies of classes when a new thread is started. This is a problem for numerous reasons:
Static properties may have been modified, and since the default values of static properties are not retained (unless opcache is used), we cannot make clean copies of classes. This forces us to copy objects like Threaded objects and other things which might not be copyable, like resources.Resolved since PHP 8.1In PHP 8.1, we will need to copy enum classes, which have object constants. This is problematic for the same reason - we can't conveniently copy objects (although we could copy the AST that instantiates them, but again, without opcache, this is typically not retained).Resolved by other meansWe can avoid all of these issues by copying the class to persistent memory when it is loaded, exactly the same way that OPcache does.