Posts tagged Bytecode
Why use a PHP accelerator?
1To understand how a PHP accelerator works the best place to start is looking at how PHP code is executed by the web server. In it’s simplest form it is something like this:
Open PHP file(s) -> Parse/Compile PHP code to bytecode -> Execute bytecode
Generally what a PHP accelerator will do is store the compiled bytecode either on disk or in shared memory which almost completely eliminates the first to execution steps above. Generally the process to load a page stored in cache will be as follows:
Check file modification time of original script -> Read file from cache -> Execute bytecode
Using an accelerator with PHP can produce some fairly substantial speed improvements by removing the need to parse/compile every script prior to execution. To demonstrate this improvement with an example, the graph below shows the results of the Hello World benchmark, from the benchmarks section of this site:
The blue bars are a standard PHP configuration without any optimisation.
The red bars are when Zend Optimizer+ is enabled within Zend Server CE.
In this example it is evident that with bytecode caching enabled, in this case using Zend Optimizer+, there is a considerable speed increase for every framework tested for this benchmark.
