PHP performance optimization generates highly optimized code _php tutorials

Source: Internet
Author: User
Tags zend server
1. Upgrade PHP to the latest version

The simplest way to improve performance is to constantly upgrade and update the PHP version.

2. Using analyzers

There are a lot of reasons why websites are slow, and Web applications are extremely complex and confusing. And one possibility lies in the PHP code itself. This parser can help you quickly find the code that is causing the bottleneck and improve the overall performance of your site's operations.

Xdebug PHP extension provides powerful features that can be used for debugging or for parsing code. Allows developers to directly track the execution of scripts, real-time view of comprehensive data. You can also import this data into the visual tool Kcachegrind.

3. Error checking report

PHP supports a powerful error-checking feature that allows you to check for errors in real time, from more important errors to relatively small running tips. A total of 13 independent reporting levels are supported, and you can generate user-defined test reports based on these levels of flexible matching.

4. Using PHP extensions

All along, we are complaining that PHP content is too complex, in recent years the developers made a corresponding effort to remove some of the redundant features of the project. Even so, the number of available libraries and other extensions is considerable. Even some developers are starting to think about implementing their own extension scenarios.

5. Using the PHP accelerator

In general, PHP scripts are compiled and executed by the PHP engine, and are converted to machine language, also known as opcode. If the PHP script has been compiled repeatedly to get the same result, why not skip the compilation process completely?

With the PHP accelerator, you can do this completely, caching the PHP script's compiled machine code, allowing the code to execute immediately as required without the tedious compilation process.

For PHP developers, there are two available caching options, APC (alternative PHP cache, optional PHP buffer), which is an open source accelerator that can be installed through pear. Another popular scenario is Zend Server, which not only provides opcode caching techniques, but also provides caching tools for the corresponding pages.

6. Avoid high-cost operations with memory cache

PHP often plays an important role in retrieval and data analysis, which can lead to performance degradation. In fact, some operations are completely unnecessary, especially from the database repeatedly retrieving some commonly used static data. Consider the short-term use of Memcached extension to cache data. Memcached's extended cache works with the libmemcached library, caches data in RAM, and allows users to define the age of the cache, helping to ensure that user information is updated in real time.

English Original: http://www.phpbuilder.com/columns/php-performance-tips/Jason_Gilmore07122011.php3?page=1

http://www.bkjia.com/PHPjc/323925.html www.bkjia.com true http://www.bkjia.com/PHPjc/323925.html techarticle 1. The simplest way to upgrade PHP to the latest version of performance is to constantly upgrade and update PHP versions. 2. There are a lot of reasons why using the profiler Web site is slow, Web applications are extremely complex, so ...

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