A great way to fine tune the performance of your application is to profile it with Xdebug. When configured correctly, Xdebug will output trace files like ‘cachegrind.out.2193401842’ which you can then run through a profiling visualisation app like KCachegrind. Graphical output typically looks like this and this and will detail the number of bytes of RAM consumed by each method in your code, as well as milliseconds spent, helping you isolate bottlenecks.
There are a number of steps you’ll need to take to setup your environment before you can use these tools – if you’re running Windows, forget it, you will need a Linux flavour – the following configuration worked for Fedora Core 2.
This is the easy part, this will give you version 2.0:
pear install xdebug
Goto the KCachegrind download page. Download the following libs:
You’ll also need QT development libs:
which will not compile unless you set the following environment vars:
export QTDIR and QTHOME=/usr/lib/qt-3.3
and the KDE libs (core 2 runs the gnome desktop environment by default)
and finally, you’ll need the graphviz package:
Have fun 🙂