Results 1 to 6 of 6

Thread: How to improve the efficiency caching in PHP?

  1. #1
    Join Date
    Feb 2010
    Posts
    207

    How to improve the efficiency caching in PHP?

    Actually I am trying to become a PHP programmer I have developed some web using this website, but that is not the matter of concern. The thing I want to know how to improve the efficiency caching in PHP because this will help me to boost the performance of the website I am developing. I will be waiting for the related replies.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: How to improve the efficiency caching in PHP?

    If the method of the class can be defined as static, as defined on the static, its speed will increase nearly four-fold. “$ row [ 'id'] speed is $ row [id] of 7 times.” . Echo faster than print, and use echo multiple parameters (translate and annotate: means the use of a comma instead of dot) instead of string concatenation, such as echo $ str1, $ str2. In the implementation of the for loop to determine the maximum number of cycles before, do not be calculated once per cycle maximum, it is best to replace the use of foreach.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Tips for improve the efficiency caching in PHP

    These tips may help you to increase the performance of your website.
    1. Write-offs, especially those who do not have a large array of variables in order to release memory.
    2. Try to avoid the use of __get, __set, __autoload.
    3. require_once () very expensive.
    4. Include file, try to use an absolute path, because it avoids the PHP where to find files include_path speed, the time required to resolve the operating system path may be minimized.
    5. If you want to know the script to start (translate and annotate: the server receives a client request) time, using $ _SERVER [ 'REQUEST_TIME'] is better than the time ().

  4. #4
    Join Date
    Jan 2008
    Posts
    1,521

    Re: How to improve the efficiency caching in PHP?

    It will better if you more concentrate on these. The function instead of regular expressions to complete the same function. “str_replace” function, the function faster than preg_replace, but strtr function efficiency is four times the str_replace function. If a string replacement function, acceptable or character array as a parameter, and the parameter length is not too long, you can consider an additional write a replacement code, making each passing parameter is a character, rather than just write a line of code to accept an array of As a search and replacement parameters.

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    Re: How to improve the efficiency caching in PHP?

    Following section may help you
    Using the select switch statement (translate and annotate: a switch case) is better than multiple if, else if statements. With @ screen error messages to be very inefficient and extremely inefficient. Open the apache's mod_deflate module can improve the web browsing speed. The database connection should be switched off when using the finished, do not use a long connection. The error message and costly. In the method of increasing local variables, speed is the fastest.

  6. #6
    Join Date
    Apr 2008
    Posts
    2,005

    Re: How to improve the efficiency caching in PHP?

    If possible increment a global variable increments a local variable is slower than the two-fold. Increasing an object property (eg: $ this-> prop + +) increments a local variable is slower than 3 times. Increment a local variable is not predefined increments than a predefined local variable 9 to 10 times slower. Only do not define a local variable in the function call it, it will also slow down the speed (equivalent to increasing the extent of a local variable). PHP probably will check to see if there is a global variable.

Similar Threads

  1. Need tools to improve the efficiency of Linux
    By Edwards in forum Operating Systems
    Replies: 3
    Last Post: 24-03-2010, 01:39 AM
  2. How to improve the efficiency of wordpress by utility tool
    By Radames in forum Technology & Internet
    Replies: 5
    Last Post: 23-03-2010, 01:31 AM
  3. How to improve efficiency of MySQL query
    By Mahish in forum Software Development
    Replies: 4
    Last Post: 21-02-2010, 06:13 AM
  4. Replies: 1
    Last Post: 29-12-2009, 09:44 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,024,876.30193 seconds with 17 queries