PHP - Speed Optimization

Speed Optimization

PHP source code is compiled on-the-fly to an internal format that can be executed by the PHP engine. In order to speed up execution time and not have to compile the PHP source code every time the Web page is accessed, PHP scripts can also be deployed in executable format using a PHP compiler.

Code optimizers aim to enhance the performance of the compiled code by reducing its size, merging redundant instructions and making other changes that can reduce the execution time. With PHP, there are often opportunities for code optimization. An example of a code optimizer is the eAccelerator PHP extension.

Another approach for reducing compilation overhead for PHP servers is using an opcode cache. Opcode caches work by caching the compiled form of a PHP script (opcodes) in shared memory to avoid the overhead of parsing and compiling the code every time the script runs. An opcode cache, APC, is planned to be built into an upcoming release of PHP (but not 5.4 as previously planned ).

Opcode caching and code optimization can be combined for best efficiency, as the modifications do not depend on each other (they happen in distinct stages of the compilation).

Read more about this topic:  PHP

Famous quotes containing the word speed:

    Spig Wead: I’ve been thinking what a heel I’ve been about you and about my own kids. I don’t know, when I do something, I go all the way. Living. Gambling. Flying. I tap myself out. I guess that’s the way I want it to be. Maybe even the way I am.
    Minne Wead: Star-spangled Spig. Damn the martinis, full speed ahead and don’t give up the ship.
    Frank Fenton, William Wister Haines, co-scenarist, and John Ford. Spig Wead (John Wayne)