Why should we upgrade to the PHP5 platform?

Source: Internet
Author: User

Because the PHP5 platform 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 (http_load can also be used)

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

PHP 4.4.2 Test Results]

[Function]

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

[Class]

Do not instantiate class

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

Instantiation class

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

Class inheritance

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

[PHP5 platform test results]

[Function]

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

[Class]

Do not instantiate class

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

Instantiation class

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

Class inheritance and abstraction

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

[Test Results and Analysis]

[Test Result Data]

Version function testing does not instantiate the inheritance of class instantiation classes

PHP 4.4.2 1047.23/rps 1034.98/rps 1006.14/rps 992.95/rps

PHP 5.2.1 1176.06/rps 1197.17/rps 1187.93/rps 1128.54/rps

[Result Analysis]

1. In general, we can see that the performance of PHP5.2 is slightly higher than PHP4.4, so do not doubt that PHP5.2 performance will be poor, obviously faster than PHP4

2. the parsing performance of classes in PHP4.4 is much slower than that of functions, especially when inheritance is used, therefore, PHP4.4 is more suitable for process-oriented and non-inherited class operations.

3. in PHP5.2, the result is that the class execution speed is faster than the function. It can be seen that the PHP5.2 engine has spent a lot of effort on object-oriented processing. At the same time, both functions and classes have good performance.

4. Through this test, we have reason to upgrade PHP4 to the PHP5 platform when the code has not changed much, and PHP5 is basically backward compatible with the PHP4 Code, except for some special code. In addition, PHP Group will not continue to maintain PHP4 after the end of this year, so it is easy to upgrade early.


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.