making bbPress (and WordPress) work better!

Posts tagged “php performance

PHP 7 Opcache adds Huge Pages support for extra performance

The PHP 7 opcache (open sourced by Zend, which replaced APC) gets a little performance boost from the added support of Huge Pages by Dmitry Stogov:

Added an experimental ability to move PHP code pages (PHP TEXT segment) into
HUGE pages.

; Enables or disables copying of PHP code (text segment) into HUGE PAGES.
; This should improve performance, but requires appropriate OS configuration.

Note that PHP must first be compiled with the appropriate configure option:

./configure --enable-huge-code-pages  (... etc.)

Essentially, Huge Pages (on OS that support them) reduces the size of the index that has to be searched to find allocated memory by allowing larger chunks of memory to be claimed instead of smaller blocks.

See the Debian wiki for a better explanation of huge pages:

This will have to benchmarked to prove if it really enhanced performance and by how much (I suspect low single digits but everything helps).

Also new to PHP 7 will be a file-based cache for the opcache which can be used as either the primary or a secondary cache level: (more…)

WordPress 10% faster with Zend Optimizer Plus vs APC opcode cache

As PHP internals explores replacing the APC opcode cache with an open-sourced Zend Optimizer Plus an interesting benchmark was published. It shows WordPress serving nearly 10% more pages per second than APC while using Optimizer+ (both under PHP 5.5).


WordPress nearly 10% faster on PHP 5.4 than 5.3

The speed improvements in PHP 5.3 over PHP 4 were significant.

Now comes news of some additional improvements to squeeze out nearly 10% more performance:

WordPress desperately needs every ounce of help it can get as it grows more and more sluggish with every release, so this is helpful news.

filemtime – the performance killer ?!

(This is NOT an issue if you just use filemtime once or twice on a page on the web. It’s just something I discovered after trying for an hour to debug a very large PHP script I wrote to process a great deal of data.)

filemtime is a “simple” function in PHP which just returns the date that a file was last modified. Sounds straightforward enough eh? Well if you are checking 1000 files, filemtime will actually DOUBLE the amount of time used if just reading the file with file_get_contents! Crazy right? Well the logic makes sense when you think about it. file_get_contents can be cached by the OS. filemtime cannot, because it assumed you need the newest, latest, uncached date fresh off the file to see if it was recently modified, even if you run the script twice, immediate after itself.