Feature request: Compatibility with igbinary extension
Environment
- PHP: 7.2.2
- pthreads: https://github.com/krakjoe/pthreads/commit/d882b1c3b1c1f6aa025d4fcd3e876c98da3741cb
- OS: Windows x64
Summary
As we know pthreads serializes any non-thread-safe object set as a member of a thread-safe one. In some applications (such as mine) this serialization poses problems for performance and also for memory usage.
This issue is a request to allow pthreads to internally use the igbinary extension serializer. igbinary in many scenarios can be faster than the PHP serializer, and also uses significantly less memory for larger objects (because it does not try to be human readable).
This can be worked around by explicitly serializing using igbinary in userland, but it would be nice if pthreads had a mechanism to optionally use this internally, either by php.ini directives or compile-time configure flags. Since pthreads only needs to be able to represent an object as a string for copying between threads, it should play with igbinary very nicely.
I'm working on implementing this in my fork - an initial (ugly) changeset can be seen at https://github.com/pmmp/pthreads/compare/fork...pmmp:experimental/igbinary .
Interestingly there is a behavioural difference which "allows" anonymous classes to be serialized and unserialized. I don't know if this is an igbinary bug, but it's sure useful in pthreads' case.