Benchmarking PHP accelerators
How does an accelerator works ?
Executing a PHP scripts takes a few steps :
- PHP loads the file,
- it parses the source file, and transforms it into opcodes (code that can be executed by the server),
- it executes the opcodes.
The accelerator takes the opcodes from step 2 and caches them in shared memory or on disk. Those cached opcodes are then directly reused the next time the PHP file is executed, without loading & parsing the file again.
Some accelerators add an optimization step which removes unnecessary code (empty loops, unused variables, …). In most cases, this optimisation step does not improve performance much.
Available accelerators
There are 3 accelerators (at last 3 that are stable, maintained and fast) :
近期评论