Connect with us

Website

PHP 7 performance improvements

Published

on

PHP 7 performance improvements

On November 28th 2019, Zend Technologies released PHP 7, an overhaul of PHP 5.6 that drastically improved its performance. What’s more, PHP 7 comes with a whole host of brand-new features. These changes improved on all areas of the language, leading to new-found user interactivity.

PHP 7 features

Plenty of new features came along with the long-awaited PHP 7 performance improvements. This update provided the PHP community with a programming language that could finally compete with more modern frameworks.

For starters, PHP 7 now operates over twice as quickly than PHP 5.6. Plus, users can now add static-type hints for static analysis and error detection, along with many other features that experienced programmers have been waiting for.

Advertisement

One of the biggest updates was the addition of anonymous classes, allowing for improved testability within the PHP framework. Anonymous classes allow you to test abstract classes without extending them, as well as changing the visibility of a property or method for testing purposes.

Other type hint additions included Scalar and Return type hints that enable far more flexibility in how you use types overall. The PHP 7 update also brought with it a wealth of new syntax options for users to play around with.

These are just a taste of the new features, and we highly recommend visiting the official PHP 7.0 guide to get fully versed with what the updated provided.

Advertisement

PHP 7 performance improvements

When compared to PHP 5.6, PHP 7 is incredibly efficient. To demonstrate the power of PHP 7, Zend Technologies ran numerous performance tests on a variety of PHP applications to compare PHP 7 and PHP 5.6.

These tests compared requests per second across the two versions of the popular scripting language, analysing the speed at which the code was executed, and how fast queries to database and server where returned.

At the end of all these tests, Zend Technologies demonstrated an overall performance increase of more than 100% for PHP 7. Below are some of the details for one of the tests conducted.

Advertisement

PHP performance on WordPress and Drupal

WordPress and Drupal, two of the most popular content management systems that run on PHP, are used worldwide for everything from personal blogs to massive corporate websites. Between them, they host over 25% of all websites on the internet!

To give you an example of just how much more efficient WordPress hosting on PHP 7 is, a single WordPress request on PHP 5.6 executes around 100 million CPU instructions. The same request on a WordPress site running PHP 7 however, is executed with just 25 million CPU instructions.

The performance of both WordPress 3.6 and 4.1 on PHP 7 were improved significantly when compared to WordPress sites on PHP 5.6. For WordPress 3.6, Zend observed 112% more requests per second, and 95% more requests on WordPress 4.1.

Advertisement

Similar performance improvements were found on Drupal sites running off PHP 7 rather than 5.6. It was found that Drupal 7 runs 73% faster on PHP 7, with 316 requests per second compared to 182 requests per second on PHP 5.6.

All of this means that PHP 7 provides a far better experience for users, with seriously streamlined code execution for both WordPress and Drupal sites.

New PHP frameworks

A sort of ‘code template’, a PHP software framework is used to increase the efficiency of PHP application building. Instead of building each application from scratch, a software framework gives the developer a scaffold around which to build their PHP application. Software frameworks are made even more efficient with PHP 7. Laravel on PHP 7 serves 70% more requests per second than Laravel on PHP 5.6. And Zend Framework on PHP 7 serves 95% more requests per second than on PHP 5.6. This makes it even quicker for developers to build applications and requires less server space to do so.

Advertisement

Ecommerce on PHP 7

The ecommerce platform Magento is the powerhouse behind over 250,000 online merchants worldwide, and is the most popular ecommerce platform in the world. And guess what? All of its systems run on good old PHP.

Once again, significant performance improvements were observed when running Magento on PHP 7 when compared to PHP 5.6. Memory consumption is reduced by 30% when running Magento on PHP 7, meaning that a single server can serve up to three times as many user requests!

Homepage requests per second were also improved, witnessing an increase of 68% on PHP 7. Plus, catalogue requests per second improved by 112% compared to Magento sites running PHP 5.6.

Advertisement

These improvements to performance and response time will drastically reduce page load times. This is crucial for ecommerce success, as it has been shown that 54% of users abandon online purchasing journeys that load too slowly. What’s more, 25% of users will leave a website if it takes more than 4 seconds to load.

How to install PHP 7

It’s very easy to install PHP 7 on your device. Simply click on the official download link from the PHP 7 website and locate the download file. Then all you have to do is extract the zip, verify the installation, and follow the configuration steps to enable PHP 7 to work with your system.

Advertisement

I am a serial tech entrepreneur, entrepreneurial ecosystem builder and a web developer.

Continue Reading
Advertisement
Comments

Trending

© 2023 SirsteveHQ Limited. All Rights Reserved.