Replies: 1 comment 1 reply
-
Hey @staabm, there is one thing Go is really, really good at, and that's asynchronous programming; which happens to be what php is really bad at. :) I've used frankenphp (in three projects now) as a Go library to handle chunking out work instead of pure php. It is usually only a few hundred lines of Go to do what would take hundreds, if not thousands of php lines to do the same job. Essentially, serve a simple unix:// server (or http if unix sockets are not available), then send it work. There are three endpoints:
I think the biggest challenge for you is that this requires a ZTS build of PHP. At that point (since you probably don't need a full webserver running for unit tests), it might be easier to use the Parallel extension, which is much better than forking. If you are looking for more of a drop-in solution that doesn't need special builds of PHP, I've previously had great success with amphp's workers. They will use a gaggle of pre-booted worker processes (or threads in ZTS builds) automagically. This is probably the best way to distribute/parallize the work IMHO. |
Beta Was this translation helpful? Give feedback.
-
I am currently thinking about ways on how PHPUnit could be faster.
I am asking myself whether PHPUnit subprocess handling could benefit from similar ideas frankphp has implemented.
like e.g. instead of creating one-off processes, use a somehow pre-booted worker process to run isolated tests (PHPT tests, or process-isolation tests)
In the past I looked e.g. into using process-forking which showed great results perf-wise, but needs quite invasive changes into phpunit. I am wondering whether there is kind of "standard solution" which can be used on the PHP CLI (or other CLI SAPI) to make use of PHP worker processes.
I did a in-detail investigation of possible changes in sebastianbergmann/phpunit#5749 but I wanted to chim in a few other people which might be deeper in this topic then I am and also are interessted to get PHPUnit faster.
Would love discussing ideas.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions