Trying out the JIT in PHP 8.4

  Рет қаралды 7,936

PHP Annotated

PHP Annotated

Күн бұрын

Пікірлер: 23
@phpannotated
@phpannotated 4 ай бұрын
I made a followup with some more benchmarks to address some of the questions in the comments: kzbin.info/www/bejne/a4PIpH6odtOjeNk 🚀
@DigitalLobstershow
@DigitalLobstershow 4 ай бұрын
Am excited for php8.4 🎉
@batfeats
@batfeats 5 ай бұрын
I've personally seen much better performance from JIT in my CLI benchmarks, but the opcache needs to primed before taking measurements.
@bedramtamang1439
@bedramtamang1439 5 ай бұрын
Awesome experiment
@awabomer
@awabomer 5 ай бұрын
Hi, beautiful content. I would like to suggest you add time stamps to be able to watch the segments for people with less patience for long videos, thanks
@phpannotated
@phpannotated 4 ай бұрын
Didn't I do that? Or do you mean more? Thanks!
@barneylaurance1865
@barneylaurance1865 4 ай бұрын
I think the start of "What is JIT?" as slightly wrong and misleading. Saying that PHP is normally interpreted whereas Java is compiled, but PHP can be interpreted with the JIT makes it sounds like there couldn't be JIT's in Java. But Java also has JIT compilers. Both PHP and Java are in fact compiled to byte code. The PHP compiler is just better at hiding than the java one (by being fast, being bundled with the engine and running on demand, and only saving the output in a cache and running it, not saving it into any file intended for saving permanently) The JIT in both PHP and Java is not for compiling from source code - it's for compiling from byte code to machine code.
@mehdi-vl5nn
@mehdi-vl5nn 4 ай бұрын
yes ,Java and C# both utilize JIT (Just-In-Time) compilation. They compile to IL (Intermediate Language), which is then interpreted initially, and later the JIT optimization occurs. Similarly, in JavaScript, at least in V8, a comparable process takes place.
@StrangerWolf-x6z
@StrangerWolf-x6z 5 ай бұрын
Thx for the investigations and test. Actually looks like there are no reasons to use JIT at the moment for boost performance.
@phpannotated
@phpannotated 5 ай бұрын
Well, let's see if anyone in the comments tells me whether I messed something up before drawing definitive conclusions though!
@martinh4982
@martinh4982 4 ай бұрын
I have no idea how these things work, but a couple of thoughts spring to mind: 1) I imagine the JIT has a load of instrumentation code in order to recognise when, if, and how something needs to be optimised. That won't be cost free and if nothing can be optimised it could lead to degraded performance. 2) It might be worth trying some highly CPU intensive pure PHP code to see if you get any improvement from the JIT.
@phpannotated
@phpannotated 4 ай бұрын
True! I did the highly CPU intensive part in my previous benchmark by generating a mandlebrot; there it has a huge effect. Unfortunately, a mandlebrot isn't really useful in real life apps :p
@DanielOpitz
@DanielOpitz 4 ай бұрын
I have not tested it, but I think JIT could improve performance for long-running process with intensive operations. So maybe the PHP shared nothing architecture is not the right use-case.
@phpannotated
@phpannotated 4 ай бұрын
Possibly!
@pierrejoye
@pierrejoye 4 ай бұрын
I am not sure "very very" small in the right outcome reading one of the bench, that's almost 9%~. At the stage where php is, this is a pretty good improvement. And yes, it won't help for apps doing mostly IOs anyway, but that's not where jit will do good :)
@apostnikov
@apostnikov 5 ай бұрын
I bet it has no effect because you're using built-in server which only populates buffer but does not actually use it
@phpannotated
@phpannotated 5 ай бұрын
That _might_ be the case, although the CLI experiment should in theory work
@mtdr3
@mtdr3 5 ай бұрын
I believe the slowest thing in phpstan is it's file operations. I think that is not a good benchmark.
@phpannotated
@phpannotated 5 ай бұрын
That is a good point! Although I do remember the PHP 8.0 discussions where static analysers were mentioned as one of the possible areas the JIT would help.
@vrontogatos
@vrontogatos 4 ай бұрын
JIT couple of years? Maybe you mean decades?
@feelingfun5149
@feelingfun5149 5 ай бұрын
Maybe testing JIT with only 50 requests is not a good idea?
@phpannotated
@phpannotated 5 ай бұрын
Why not? If it doesn't affect 50 request, it shouldn't affect 1000 either. The JIT could potentially optimise small parts of your code within a request, not requests as a whole
@373323
@373323 4 ай бұрын
it seems to produce any significant difference , might as well not be part of the code base , it's a useless feature as it stands today
Benchmarking the JIT… again.
8:20
PHP Annotated
Рет қаралды 3 М.
PHP 8.4 Is Good
15:18
ThePrimeTime
Рет қаралды 130 М.
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 21 МЛН
Using Generics with PHP
25:55
Laracasts
Рет қаралды 15 М.
Дмитрий Стогов - IR JIT Framework: база для следующего поколения JIT в PHP
45:46
JPoint, Joker и JUG ru — Java-конференции
Рет қаралды 567
Все сложно в PHP 8.4...
9:20
Bonch dev
Рет қаралды 3,6 М.
Is PHP Dying in 2024?
18:30
Stefan Mischook
Рет қаралды 18 М.
Lazy objects in PHP 8.4
34:37
PHP Annotated
Рет қаралды 9 М.
The Value of Source Code
17:46
Philomatics
Рет қаралды 213 М.
What's New and Exciting in PHP 8.4
9:58
php[architect]
Рет қаралды 16 М.
Laravel Actions: The Secret Sauce
4:06
Nuno Maduro
Рет қаралды 7 М.
Controlling randomness in Laravel (watch me code)
20:30
Aaron Francis
Рет қаралды 6 М.