I recently noticed this interesting post regarding performance: https://magento.stackexchange.com/a/124/2380

So according to the OP, it seems like removing the references to Varien_Profiler in the Magento core files (around 500 references in could speed up the performance by up to 5%

So I was wondering if anyone has ever done that ?

If so, apart from the command line the OP posted:

grep -l "Varien_Profiler" * -R > profiler.txt 
for x in `cat profiler.txt` 
sed -i '/Varien_Profiler/s/^/\/\//' $x

Or as one of the comments say:

find . -type f -exec grep -qF 'Varien_Profiler' {} \; -exec sed -i '/Varien_Profiler/d' {} \;

Is there anything else that needs to be done ? The OP also said:

You might need to adjust the file /lib/Varien/Profiler.php manually afterwards.

Also, I was wondering apart from not being able to use the profiler, is there any downside to this operation ? I'm talking about possible code issues related to the profiler that could possibly break the system.

  • this is indeed true. Varien_Profiler is a great tool while we developing a site. But it will indeed reduce performance since there is numerous amount of varien_profiler check in core magento. So removing it AFTER DEVELOPMENT stage has no downsides in my opinion. Jun 10, 2016 at 8:51
  • ... And I feel this question is off-topic since it is purely an opinion based. Jun 10, 2016 at 8:52
  • @RajeevKTomy have you ever done it ? Do you have some results to share ? I don't think it's opinion based it's a real coding question Jun 10, 2016 at 8:53
  • Yes I did that in my development environment when I found that answer a long time before and I saw improvements in performance.But It was lesser than 5% at that time. If I remember correctly, it was around 3-4%.But this figure will vary from site to site. Because core Magento holds some Varien_Profile check in entity/collection load.So more number of entity/collection load in site means more number of varien_profiler calls. So in those sites improvements will be much greater.For perfectly tuned sites (sites in which entity/collection load is min), removing varien_profiler won't make much diff Jun 10, 2016 at 9:00

1 Answer 1


You can safely remove any reference to Varien_Profiler, nothing will break at least if you keep the profiler disabled in configuration.

  • The methods in Varien_Profiler do not have return values, except fetch and getSqlProfiler(), both are only used in Mage/Core/Block/Profiler.php to display results.

  • Except from the private state of Varien_Profiler, no methods of the class have side effects.

That being said, I don't believe it's worth the trouble and smells a lot like premature optimization. If the profiler is disabled (Varien_Profiler::disable()), all the methods return immediately.

Focus on the real bottlenecks instead, i.e. database and filesystem, not method calls that do nothing.

  • 2
    "Focus on the real bottlenecks instead, i.e. database and filesystem, not method calls that do nothing." - I've seen a lot of people trying to spend inordinate amount of time in trying to optimize in memory stuff when actually db calls and file system lookups kill you!
    – Paras Sood
    Jun 10, 2016 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.