Magento has a lot of built in features designed to help the developers like you debug / profile and optimize the whole website that’s running on top of the latest Magento installation, as well as to profile and debug, then optimize the Magento Extensions and Addons that you have running.
It’s always worth going over the code and making sure it’s performing at it’s best. And even if that’s not the case, you should consider profiling your pages if you think they appear to be slow. Finding out the underlying cause is the only way you can make sure that the issue with the speed of your Magento website is resolved and that it does not appear again.
Magento does have a noteworthy profiler buit in and you can enable it and use it similarly to any other Developer feature that the platform offers. Here’s how to enable the profiler on your e-commerce website.
In your Magento admin go to System > Configuration from the top menu, then Advanced > Developer option from the left submenu. On the Developer settings page open the Debug section and switch Profiler dropdown to “Yes”.
Open the index.php file of your Magento website in your favorite code editor, track down the following line of code:
And un-comment it if it is commented out. The exact line number of this line of code varies from Magento version, but it should be there. If it’s not, add it and save the changed index.php file.
Now, open up the website in your browser and scroll down to the bottom of the page. You should see a [profiler] link in the footer of the page. If you click on the link, it will expand and it will show you the following stats:
– This column represents the code section that’s being profiled. Consider it like a path hint to the area of the code that’s being executed and profiled.
– And here’s the counter. It shows the count of the execution times for the area of code. See how many times has the code area been called by the page that you are profiling – this can show you the areas that are most interesting for additional caching.
– Here’s the data of memory usage by this area of the code.
– RealMem shows just how much of memory has been allocated to PHP
The default profiler does do the job it’s supposed to, and does it quite well. However, the output leaves few things to be desired. It’s very hard to go trough and navigate, and pull the relevant data especially as there’s so much of it.
There is however a great Magento Extension that extends the default Magento Profiler. It’s called Aoe Profiler / Magento Profiler and it’s available on Github as well with a very simple set of instructions.
Please be sure to take a look at the AOE Profilers Author page for more information about it, we certainly recommend this Magento Extension.