GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  PHP
Go To First  |  Previous Question  |  Next Question 
 PHP  |  Question 19 of 74    Print  
What do you need to do to improve the performance (speedy execution) for the script you have written?

  
Total Answers and Comments: 3 Last Update: October 10, 2007     Asked by: Lokesh M 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: A.P.Palaniraja
 
There are many things to be considered.

If your application based on Database, you should think about re-factoring queries try to use high performance queries (Use EXPLAIN to monitor the amount of records retrieved for each query. You can use UNIQUE, LIMIT, WHERE to filter the no of records returned).

And also you should be aware of fine tuning configuration for your needs.
In PHP you should use native functions instead of aliases. And also you should choose best function for the job. If you are going to do simple string replace use str_replace than ereg_replace. Use is_int() instead of is_integer().

Use DBG or xdebug to profile your scripts, find the bottle neck function and try to re factor if possible.

Above answer was rated as good by the following members:
varunk2006, lizzeelike, stikadia
October 10, 2006 07:47:51   #1  
honey        

RE: What do you need to do to improve the performance ...

If your script is to retrieve data from Database you should use Limit syntax.

otherwise...


 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 0Overall Rating: +2    
October 26, 2006 03:30:01   #2  
vinit sharma        

RE: What do you need to do to improve the performance ...
There are two approaches :1) Use the templates like SMARTY or Cache_lite FOR templates building.2) Break down the section of website which need not be repeated overa period of time say only to be updated in 2-3 days [For example Header menu . footer anouncement etc ] Create a html page for these sections using the php logic that was used to create the page section in runtime This can be automated using cron also . the rest of the section which has to be very dynamic will take less time to be build now
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
October 10, 2007 05:33:44   #3  
A.P.Palaniraja        

RE: What do you need to do to improve the performance ...
There are many things to be considered.

If your application based on Database you should think about re-factoring queries try to use high performance queries (Use EXPLAIN to monitor the amount of records retrieved for each query. You can use UNIQUE LIMIT WHERE to filter the no of records returned).

And also you should be aware of fine tuning configuration for your needs.
In PHP you should use native functions instead of aliases. And also you should choose best function for the job. If you are going to do simple string replace use str_replace than ereg_replace. Use is_int() instead of is_integer().

Use DBG or xdebug to profile your scripts find the bottle neck function and try to re factor if possible.

 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 0Overall Rating: +2    


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape