WordPress page load times: PHP 7 vs. PHP 5.6 [Research]
Robert-Jan Budding, September 6, 2016
Recently, PHP 7 has been released on our platform. PHP 7 is a huge improvement in comparison with its predecessor PHP 5.6. Especially in the field of performance and speed, PHP 7 is as good as or even better as its competitors like Hip Hop Virtual Machine (HHVM). In this PHP 7 article you can read all about the reasons for this update and why it is an improvement focusing on WordPress page load times. In case you want to update your site to this new version, go to our control panel where we have made it easy for you to switch.
WordPress page load times
Everyboday wants a fast site. Many of our customers are using plugins to set up their caching, next to the Varnish caching that we have already set up for you. Using these plugins could be a good idea when you want to improve your site speed with the minify and combine functionalities of these caching plugins.
Upgrading to PHP 7 looks beneficial, but how much better is it actually? To find out, we have tested the plugins for speed and render time on PHP 5.6 and PHP 7. We also tested Memcached, which gave us interesting insights.
After we have conducted these tests in our test environment, we found out that PHP 7 greatly improves WordPress page load times. The total load time decreases with 40%, without the usage of any caching. But what about load times when using a caching plugin?
How did we test?
We installed WordPress 4.5.3 with WooCommerce 2.6.4. A hundred and fifty products were loaded inside the WooCommerce shop. Furthermore, we installed Yoast SEO and a theme named Avada. We used our own hosting platform:
- Savvii VPS One
- PHP 5.6 and 7
- HTTP connection
- Database and Varnish caching both turned off
We researched the following plugins:
These are the most popular plugins our customers are using. We tested every plugin on PHP 7 and PHP 5.6. At the same time we turned Memcached off, also for W3TC. We did test Memcached Redux, without using any caching plugin.
We used the popular benchmark tool Webpagetest.org. Every test was run 9 times, while having the “Stop Test at Document Complete” option turned on and using this header “Cache-Control: no-cache, must-revalidate”, so all tests are conducted without the usage of Varnish.
Unfortunately, W3TC doesn’t work in combination with PHP 7. A workaround is available, but we choose not to use this workaround because we do not recommended fiddling around in code. When updating errors could arise, or worse, backdoors could be created.
<<Update: The latest version of W3TC does support PHP7.>>
Results 1: Load Times
The Load Time is measured as the time from the start of the initial navigation until the beginning of the window load event.
Graph 1: Load Times
The differences are very clear when using different versions. Not using a caching plugin decreases the load time with 0.3 seconds. When using caching plugins, the differences are next to zero: caching will catch most of the PHP requests and will serve mostly plain HTML.
Results 2: Time to First Byte
The Time to First Byte (often abbreviated as TTFB) is measured as the time from the start of the initial navigation until the first byte of the base page is received by the browser.
Graph 2: TTFB
Here the results are showing the same as for the Load Time. Not using a plugin means a huge difference between PHP 5.6 and 7, but when a plugin is installed the differences aren’t that big. We do see a decrease in TTFB when using WP Super Cache on PHP 7, while WP Rocket is steady and fast with both versions.
Results 3: Speed Index
The Speed Index is a calculated metric that represents how quickly the page rendered the user-visible content (lower is better).
Graph 3: Speed Index
Again, differences are clear between an uncached PHP 5.6 or 7 site. It is notable that WP Rocket gets a relatively low score. A possibility for this could be that this plugin shows the first content later compared to W3TC and WP Super Cache.
PHP 7 does make your site faster, that much is for sure. Especially when you are not using a caching plugin the WordPress page load times of our test site increases with 0,3 seconds. The First Byte Time score increases with 40%. When you do use a caching plugin the results are minor. That is because most of the PHP requests are being done by caching and therefore the version of PHP is not all that important.
When using Memcached Redux without using a separate caching plugin, this plugin does not help you much. The fist content is shown a bit faster, but in most of tests it appears to be slowing down your site rather than making it faster. So we would not recommend this.
Because not all pages of a website will be served from cache we do recommend using PHP 7, because it is just faster. In our test WP Super Cache is overall the fastest plugin using PHP 7. WP Rocket has the best load times but a relatively slow Render Time score, which means that the first pieces of content are shown a bit later than with the other plugins. And users love to see content as soon as possible! W3 Total Cache shows good results overall as well, but at the moment of writing this article is not available yet to use in combination with PHP 7.
In conclusion, the best way of finding out how to make your WordPress page load times as fast as possible is to test it with the different plugins. Results can differ with each setup.