Reasons to upgrade to PHP 5: Performance comparison between PHP 4 and PHP 5 (1)_PHP Tutorial

WBOY
Release: 2016-07-15 13:24:02
Original
1004 people have browsed it

PHP 4 will no longer be supported by the PHP Group by the end of 2007, so in order to make everyone more confident in moving to the PHP 5 platform, I specially conducted this test to see how our PHP 4 Does .x really perform better than our PHP 5.x? The test results are obvious, that is, PHP 5.x is faster than PHP 4.x in both object-oriented and process-oriented terms, so it is absolutely necessary for everyone to move to the PHP 5.x platform to experience it. Various features and capabilities of the PHP 5.x platform.

Because PHP 5 includes a new object model, more new features, and faster processing speed, especially the speed of processing object-oriented code. Although the speed of object-oriented code in PHP 4 is relatively average, in The speed of object-oriented code in PHP5.

Test environment

CPU Intel Pentium4 2.66GHz
Memory 1GB
Disk 73GB/SCSI
OS FreeBSD 4.11
Web Apache 1.3.37
测试工具 ab(也可以选用http_load)
名词RPS Requests per second(每秒的请求数量)

Related

Testing tool: ab (can also be used http_load)

Noun RPS: Requests per second (number of requests per second)

PHP 4.4.2 test results

Function

<?php <br>function signin(){<br>echo "test";<br>}<br>signin();<br>?>
Copy after login
Copy after login

Test result: ab -n 10000 -c 50 The result is 1047.23/rps

Class Class

Do not instantiate the class

<?php <br>class User{<br>function signin(){<br>echo "test";<br>}<br>} <br>User::signin();<br>?>
Copy after login

Test result: ab -n 10000 -c 50 The result is 1034.98/rps

Instantiated class

<?php <br>class User{<br>function signin(){<br>echo "test";<br>}<br>}<br>$user=new User();<br>$user->signin();<br>?>
Copy after login

Test result: The result of ab -n 10000 -c 50 is 1006.14/rps

Inheritance of class

<?php <br>class AUser{<br>function signin(){}<br>}<br>claāss User extends Auser{<br>function signin(){<br>echo "test";<br>}<br>}<br>$user=new User();<br>$user->signin();<br>?>
Copy after login

Test result: ab -n 10000 -c 50 The result is 992.95/rps

PHP 5.2.1 Test results

Function

<?php <br>function signin(){<br>echo "test";<br>}<br>signin();<br>?>
Copy after login
Copy after login

Test results: The result of ab -n 10000 -c 50 is 1176.06/rps

1

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446793.htmlTechArticlePHP 4 will no longer be supported by PHP Group by the end of 2007, so in order to give everyone more confidence to move to the PHP 5 platform, I specially did this test to see if our PHP 4.x is really...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template