Why should we upgrade to the PHP5 platform. Because the PHP5 platform includes new object models, more new features, and faster processing speed, especially the processing speed of object-oriented code, although Object-Oriented Code in php4 is fasterBecause 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.
Comparison of OSS code speed in Objective 4...