Reasons to upgrade PHP 5: PHP 4 and PHP 5 performance comparison (1) _php tutorial

Source: Internet
Author: User
PHP 4-07 at the end of the PHP group will no longer support it, so in order to let people more confident transfer to the PHP 5 platform, I specifically did this test, to see if our PHP 4.x really performance than our PHP 5.x better! The test result is obvious, that is PHP 5.x than PHP 4.x, whether object-oriented or process-oriented, is faster than PHP 4.x, so it is necessary to transfer to the PHP 5.x platform, to experience the various functions and performance of the PHP 5.x platform.

Because PHP 5 includes the new object model, more new features, faster processing speed, especially the speed of object-oriented code, although in PHP 4, object-oriented code is more common, But object-oriented code in php5.x is faster than process-oriented, so don't be skeptical about object-oriented performance, as the following test results will show.

test Environment

Cpu Intel Pentium4 2.66GHz
Memory 1GB
Disk 73gb/scsi
OS FreeBSD 4.11
Web Apache 1.3.37
Test tools AB (can also choose http_load)
Term RPS Requests per second (number of requests per second)

Related

Test tool: AB (can also choose http_load)

Noun rps:requests per second (number of requests per second)

PHP 4.4.2 Test Results

Functional Function

     
     function signin () {
echo "Test";
}
Signin ();
?>

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

Classes Class

Do not instantiate a class

     
     Class user{
function signin () {
echo "Test";
}

User::signin ();
?>

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

Instantiating classes

     
     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

Inheritance of Classes

     
     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

Functional function

     
     function signin () {
echo "Test";
}
Signin ();
?>

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

1

http://www.bkjia.com/PHPjc/446793.html www.bkjia.com true http://www.bkjia.com/PHPjc/446793.html techarticle PHP 4-07 at the end of the PHP group will no longer support it, so in order to let people more confident transfer to the PHP 5 platform, I specifically did this test to see if our PHP 4.x is really ...

  • Related Article

    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.