php

Code optimization with Xdebug and KCachegrind

We have been working on a migration script to move a custom CMS into Drupal, and one of the problems we have been dealing with is the script's performance. The server that it will run on kills PHP scripts that run for more than 5 minutes, and our script was running for about 20 minutes. By reducing the number of queries, making small code optimizations, and properly indexing and keying the legacy database we managed to cut the time to 10 minutes—still we were way off target. To get a better look at what was going on, we thought it would be great to install Xdebug and take a look at it with KCacheGrind. This combination of tools gives a very granular look at where time is spent in the code and should give some hints at where the bottlenecks are.

Here are my steps to get a LAMP stack, Xdebug, and KCacheGrind installed on a fresh copy of Ubuntu. This was done in a virtual machine hosted on my Mac but could be done on any Ubuntu install.

zroger.com - MAMP logs in console

Roger López blogged this simple tip to get your MAMP Logs to appear in your Console sidebar.

Pretty simple steps; just drop a sym-link to logs folder in ~/Library/Logs.
I imagine this could be used for other log files too.

Thanks Roger!

Syndicate content