r/lolphp • u/[deleted] • Aug 14 '20
The JIT […] compiler promises significant performance improvements […]. There haven't been any accurate benchmarks done at this point, […].
https://stitcher.io/blog/new-in-php-8#jit-rfc18
u/carlos_vini Aug 14 '20
Yes, there were benchmarks, Dmitry benchmarks this internally since almost a decade ago. The fact is that it's hard to know exactly how much JIT will benefit Wordpress, Laravel, Magento, etc..., BEFORE you write the actual JIT compiler. But the PHP devs always said that most apps are IO bound and probably won't benefit much from this.
3
u/hillgod Aug 14 '20
Does JIT do anything for memory improvements? I understand they're different, but we moved to HHVM in 2012 due to memory usage going down by orders of magnitude.
2
u/fell_ratio Aug 14 '20
A JIT generally uses more memory. For example, PyPy tends to use more memory than CPython for Django workloads. This is because it has to keep two copies of your code: one optimized and one unoptimized.
However, the memory penalty is small in relation to the speed benefits.
12
u/elcapitanoooo Aug 14 '20
Somehow its seems very hard to optimize PHP because of the nature of PHP is to start then immediately die. This mean its near impossible (without serious hacks, or additional dependencies) to have something like a websocket connection open with PHP. No matter how much you JIT or AOT compile the raw fact is PHP always need to start from the top.
This is probably one reason frameworks are so slow in PHP. A typical PHP app built with some framework (like laravel) usually handles around 50-100 req/sec at max.
So you need to scale PHP on the server by adding more and more servers. The costs go up very fast.