Static Optimization of PHP Bytecode

Nikita Popov (09.Jun.2017 at 11:15, 50 min)
Talk at PHP South Coast 2017 (English - UK)

Rating: 5 of 5

The PHP compiler turns PHP code into “opcodes”, which are then executed on the Zend Virtual Machine. To improve performance, it is possible to optimize these opcodes prior to execution. PHP 7.1 introduces a sophisticated opcode optimization infrastructure, which uses static single assignment (SSA) form and type inference to enable more advanced optimizations.

An example: Normally, an “add $a, $b” instruction first has to check the types of $a and $b, to determine whether to perform an integer addition, or a floating point addition, or maybe even an array or GMP addition. However, if we can statically determine that $a and $b are integers, we can use a special “add_int $a, $b” instruction, which does not perform these type checks and thus improves performance. Because PHP is very dynamic, doing this is harder than it may sound…

This talk introduces the new optimization infrastructure, the optimizations based on it, and discusses which parts of the PHP language are particularly hostile to this form of optimization. This is an advanced talk, but I will try to present the topic in a way that does not require a strong compiler construction background.

Who are you?

Claim talk

Talk claims have been moved to the new site.

Please login to the new site to claim your talk

Comments closed.


Rating: 5 of 5

09.Jun.2017 at 14:39 by Andrew Rota (7 comments) via Web2 LIVE

Great deep-dive into the challenges (and opportunities) of opcode optimizations in PHP!

Rating: 5 of 5

09.Jun.2017 at 23:05 by Antonis Pavlakis (108 comments) via Web2 LIVE

A great talk taking a peak under and seeing how opcode works and the difficulties with optimisation.

Rating: 5 of 5

10.Jun.2017 at 11:31 by Mark Baker (120 comments) via Web2 LIVE

Well explained step-by-step guide to what is essentially hypothesis-driven-development; looking at how opcode optimisation works; and the need to assess everything based on the edge cases (even the unlikely ones), and not simply on typical usage, to determine whether it is a viable solution; and whether the benefits justify the time and effort required to implement.
While focused on opcache optimisations, the assessment and evaluation principles used could be applied in many normal development situations as well

Rating: 5 of 5

10.Jun.2017 at 12:54 by Jason Stanley (5 comments) via Web2 LIVE

Very interesting look under the hood of php showing the opportunities and challenges which present themselves when attempting to improve the performance of the language.

Rating: 5 of 5

10.Jun.2017 at 20:40 by Tim Stamp (23 comments) via Web2 LIVE

Great overview of the optimisations that PHP does (or attempts to do) behind the scenes, and what kinds of avenues the devs behind the PHP language are exploring to improve the performance of PHP even further.

Rating: 5 of 5

10.Jun.2017 at 23:05 by Peter Fisher (50 comments) via Web2 LIVE

A well explained insight into the challenges of Opcode PHP optimisation.

Rating: 5 of 5

11.Jun.2017 at 16:06 by Nils Adermann (20 comments) via Web2 LIVE

Really enjoyed the examples of things that make seemingly simple optimizations close to impossible, which really helps understand why they aren't (yet) being done.

Rating: 5 of 5

12.Jun.2017 at 09:28 by James Titcumb (280 comments) via Web2 LIVE

Great technical exploration, really well explained.

Rating: 5 of 5

12.Jun.2017 at 20:56 by Dave Liddament (72 comments) via Web2 LIVE

A great talk. It's really interesting to learn a bit more about what goes on under the hood and the kinds of testing and research that goes on.

Every conference should have some kind of internals talk.

Rating: 5 of 5

12.Jun.2017 at 21:09 by Mark Dain (5 comments) via Web2 LIVE

Fantastic talk that gave a really good insight into the struggles of the PHP devs to optimize a complex language. I thought the pacing was good and the content was great. 5/5

Rating: 4 of 5

15.Jun.2017 at 22:52 by Neil Nand (46 comments) via Web2 LIVE

Really good talk on some of the optimisations of PHP internals but I went in with the impression that there'd be more information on how PHP developers could optimise the code the write. Maybe just make it a little clearer on the talk description?

© 2019