3 ms·
PHP doesn't have the same constraints around it as Python. With Python, you have long-running threads of execution, while this is rarely the case in PHP. PHP ha
by talideon 3y ago
PHP doesn't have the same constraints around it as Python. With Python, you have long-running threads of execution, while this is rarely the case in PHP. PHP has no shared state outside of the interpreter, so it's inherently GIL-less.
PHP got threads late and as an extension. The issues with the GIL centre around the C extension API. PHP doesn't have to deal with that, so they were able to concentrate on making single threaded performance as good as possible. The GIL also blocks some potential avenues around making single threaded performance better, which is why the plan for this current attempt is to make it opt-in.
Also keep in mind that all this is happening concurrently with efforts around making single threaded performance better, with the idea bring that any loss of performance due to the GIL removal should be compensated by other speed improvements.
If we could go back in time and make the C API more like that of, say, Lua, that would solve the issue, but we can't.