Member-only story

JIT Compiler in PHP

Atakan Demircioğlu
Developers Keep Learning

Here are my notes about the JIT compiler in PHP.

Before PHP JIT Compilation

  • each script processed in a request to a PHP web application is parsed, and then compiled into “byte codes” (op codes)
  • “op codes”, are pseudo-instructions that a virtual machine can process.
  • Zend Engine”; this is a virtual machine, similar to LLVM or the JVM.
  • A virtual machine’s job is to take those byte codes, compile them to machine code, and then execute them.
  • When the OPcache is enabled, PHP takes the byte codes it compiles to and stores them in the OPcache before passing them to the VM (Introduced in PHP 5.5). On subsequent requests, it checks to see if it has an entry for that script in the OPcache; if so, it passes those directly to the VM, thus skipping the steps of parsing and compiling to opcodes. This helps improve performance.
  • OPCache is not enough because it is memory limited. Even with an OPcache, there are bottlenecks in many applications. Also most of modern PHP frameworks tend to be bootstrap-heavy.
  • To overcome this situation PHP 7.4 introduced opcache

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Developers Keep Learning
Developers Keep Learning

Published in Developers Keep Learning

Welcome to Keep Learning, an inspiring online publication created by developers, for developers.

Atakan Demircioğlu
Atakan Demircioğlu

Written by Atakan Demircioğlu

Passionate about blogging and sharing insights on tech, web development, and beyond. Join me on this digital journey! 🚀

Responses (1)

Write a response

I tried it several times in real projects and there was no significant improvement