Is PHP 8.1 faster than PHP 8.0? Should I upgrade to PHP 8.1?

Posted on

PHP released its latest version, PHP 8.1, on November 25, 2021.

As reported by the official PHP page, this version is said to bring a massive update to the programming language. There are a number of features that were added, changed, and discontinued, to improve PHP 8.1 performance compared to previous versions.

Is PHP 8.1 faster than PHP 8.0? Should I upgrade to PHP 8.1?

Are you wondering what’s new in PHP 8.1? This article will review these things.

Advantages of PHP 8.1

Thanks to the optimization of features carried out, PHP 8.1 has several advantages over the previous version of PHP, namely:

1. Faster Performance

MetricPHP 8.0PHP 8.1
Request per second32.0234.75
Time per request31.23228.777

Based on the results of the benchmark test, PHP 8.1 has a faster performance of about 5-8% than PHP 8.0. This is thanks to the addition of a function called inheritance caching on Opcache, PHP’s built-in caching feature.

Inheritance caching connects different types of classes and then performs the caching process on classes simultaneously. Then the caching results are stored on Opcache’s shared memory.

The caching results will be stored forever, thus reducing the number of commands required. This has been shown to improve the overall performance of the program.

2. Better JIT Support

PHP improves support for the JIT (Just in Time) Compiler, a technique that allows programs to be translated into languages that the computer understands when the program is running in real-time.

JIT has actually been available since PHP 8.0, but its capabilities are improved again in PHP 8.1. One of them is the addition of backend support to the ARM64 architecture.

The existence of JIT does not have a positive impact in the near future. But in the future, there is a possibility that you can use PHP not only for websites but also for other purposes such as mobile apps.

Are you ready to migrate to PHP 8.1?

PHP 8.1 is the latest version of PHP that offers performance advantages over previous versions. This is thanks to various optimizations done, ranging from adding new features to stopping outdated features.

Are you ready to migrate to PHP 8.1? Don’t forget to do website backups, third-party feature updates, and check the compatibility of its features first.

What are you waiting for, let’s build your best website with PHP 8.1