Ok..so this is really short, no BS tutorial, on how to profile your PHP application under windows
Download windows modules for your version of PHP from http://www.xdebug.org/
Write this lines at your php.ini file
now, important stuff
replace XXXX’s in line
with name of Windows module from step 1
Also instead of c:/XXXXXX/ write path where you want to keep profiling and debug files.
Save your php.ini and restart your web server, start your local script and cachegrind files should appear in directory from step 2
Important notice, when you debug or profile large scripts (forums, blogs, etc) profiler writes a lots of data, so be careful to have enough free space, and check constantly
When you are done,refer to step 2 and change line
xdebug.profiler_enable=0 , and restart Apache again.
This will stop profiling process, and every time you wish to start profiling you must change it back to 1, and restart Apache.
Download win cachegrind from http://sourceforge.net/projects/wincachegrind/
install, and set working directory to the same direcotry as in step 2, load your files and enjoy.
Now fun part begins, you should search for functions that takes most of your execution time, and try to optimize that code…
Few general advices for fast application are:
-As less includes as possible.
-Avoid too many database connections, try to use JOINS in your SQL query to get most meaningful data.
-Avoid array sort and count inside loops.
-when ever possible use caching of database data.
Blogged with Flock