Reasons for upgrading PHP 5: Performance Comparison between PHP 4 and PHP 5 (1)

Source: Internet
Author: User

PHP Group will no longer support PHP by the end of 4 to 07, so I did this test to make everyone more confident to transfer to the PHP 5 platform, look at PHP 4. is x really better than our PHP 5. x is better! The test results are obvious, that is, PHP 5. x is better than php 4. x is more object-oriented than PHP 4. x is faster, so it is absolutely necessary for everyone to move to PHP 5. x platform to experience PHP 5. x platform features and performance.

Because PHP 5 includes new object models, more new features, and faster processing speed, especially the processing speed of object-oriented Code, although the object-oriented code speed in php 4 is relatively average, however, in PHP5.x, the OSS code speed exceeds the process-oriented speed, so do not doubt the OSS performance. The following test results show all of this.

Test Environment

CPU Intel Pentium4 2.66 GHz
Memory 1 GB
Disk 73 GB/SCSI
OS FreeBSD 4.11
Web Apache 1.3.37
Test Tool AB (you can also use http_load)
Term RPS Requests per second (number of Requests per second)

Related

Test Tool: AB (http_load can also be used)

Term RPS: Requests per second (number of Requests per second)

PHP 4.4.2 Test Results

Function

     function signin(){
echo "test";
}
signin();
?>

Test result: the result of AB-n 10000-c 50 is 1047.23/rps.

Class

Do not instantiate class

     class User{
function signin(){
echo "test";
}
}
User::signin();
?>

Test result: the result of AB-n 10000-c 50 is 1034.98/rps.

Instantiation class

     class User{
function signin(){
echo "test";
}
}
$user=new User();
$user->signin();
?>

Test result: the result of AB-n 10000-c 50 is 1006.14/rps.

Class inheritance

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

Test result: the result of AB-n 10000-c 50 is 992.95/rps.

PHP 5.2.1 test results

Function

     function signin(){
echo "test";
}
signin();
?>

Test result: the result of AB-n 10000-c 50 is 1176.06/rps.

1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.