Does the PHP __autoload () method really affect performance? _php Tutorials

Source: Internet
Author: User
Introduction

For PHP performance problems, the most talked about is the __autoload () method, many people mention that this method has a significant impact on performance. Others say that opcode can also affect the __autoload () method, so I made a test for these two points.
Finally, it is found that the __autoload method has no significant performance impact.

Environment

php:5.3.9--booting in fastcgi mode
nginx:1.1.12
eaccelerator:0.9.6.1

。 Finally, it is found that the __autoload method has no significant performance impact.
Environment php:5.3.9--start nginx:1.1.12 eaccelerator:0.9.6.1 in fastcgi mode:

Start interface:

Eaccelerator (in the php.ini file) configuration:

File structure: (each test file is a file with more than 6,000 lines of code)

Test: Test code with Eaccelerator cache: __autoload Loaded

Figure 1

The results I found in my browser were as follows: Total time:0.10401391983032total time:0.10252094268799total time:0.095267057418823total Time:0 .10013008117676Total time:0.096842050552368total time:0.097998142242432total time:0.10348510742188total Time:0. 096648931503296 test: Without __autoload ()

Figure 2

Test results-by swiping the browser total time:0.10309100151062total time:0.10285210609436total time:0.10154414176941total Time:0. 097845792770386Total time:0.099545001983643total time:0.10166597366333 Final results: The AutoLoad method does not have a noticeable performance degradation test: Cancel Eaccelerator Cache test results in Figure 1 Total time:0.24992394447327total time:0.25681900978088total time:0.25327301025391total Time:0.22580695152283total time:0.22656512260437total time:0.22530484199524total Time:0.23080611228943 The test results in Figure 2 Total time:0.23054909706116total time:0.22633790969849total time:0.23442888259888total Time:0. 2350070476532Total Time:0.22897601127625total time:0.23207712173462

The __autoload () method has no significant effect on performance.

It is concluded that the 1>__autoload method has no significant performance loss through the above two groups of experiments. So let's not go between using the __autoload method. 2>opcode the impact on the code is relatively large, obviously using opcode, PHP code execution speed increased by nearly twice times more.

http://www.bkjia.com/PHPjc/325184.html www.bkjia.com true http://www.bkjia.com/PHPjc/325184.html techarticle The most talked about PHP performance problem is the __autoload () method, which many people refer to as having a significant impact on performance. Others say that opcode can also affect the __autoload () method, so needles ...

  • 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.