Is PHP 8.1 faster than 7.4?

chcw

New member
Hi,

I just swtich from PHP 7.4 to 8.1. Based on many online posts, such as https://wp-rocket.me/blog/how-to-fix-slow-wordpress-admin/#Remove-the-WordPress-Admin-Toolbar and https://kinsta.com/blog/php-benchmarks/#php- benchmarks-2023, PHP 8.1 is much faster than 7.4

However, based on my test with following command:

ab -n 1000 -c 15

Actuall PHP 8.1 is a bit slower. It takes 1.273 seconds to complete the test. While with 7.4, it only takes 1.146 seconds.

Also in WordPress, I install Query Monitor, and it repeatedly report "deprecated function" error, which may also slower the operation.
 
When switching from PHP 7.4 to 8.1, performance improvements are generally expected, but individual results may vary. In your specific test, PHP 8.1 showed slightly slower performance compared to 7.4. Factors such as server configuration, code optimization, and caching can impact results. Deprecated function errors reported by Query Monitor in WordPress should be addressed to ensure optimal performance. Consider verifying PHP configurations, reviewing the test methodology, updating code, and implementing caching mechanisms. Continuous monitoring and improvement are key for maintaining performance.
 
Hello this is Gulshan Negi
Well, PHP 8.1 is faster than PHP 7.4. Each new version of PHP typically brings performance improvements and optimizations, and PHP 8.1 is no exception. The PHP development team focuses on enhancing the language's performance and efficiency with each release version of PHP.
But I will recommend you if you are looking for upgrading your version from PHP 7.4 to PHP 8.1, it's critical to assess the general advantages, performance, compatibility, and new features, in relation to your specific project requirements.
Thanks
 
Back
Top