Some please help me with this. Where do I find these files. I need to reduce the time line I have used memcache. Profiler details

mage 3.5387
mage::dispatch::routers_match 3.4298
mage::dispatch::controller::action::predispatch 1.0752
mage::dispatch::controller::action::cms_index_index 2.3535

Please help me reducethe time frame


Unfortunately you what you have found there is a process which runs - it doesn't equate to finding and optimising a single file in each case. The output you show is from the profiler, and the way this works is that at some point in the code execution you call Varien_Profiler::start() then at a later point you call Varien_Profiler::stop(). The profiler then tells you in the output which displays below the main site HTML how long that section of code took to execute according to the argument you send to the start() and stop() methods which acts as an identifier in the profiler output. You can also see other information such as the number of times the code in question was executed and the amount of memory allocated to PHP to execute the code.

So if you look at one example you have posted, mage::dispatch::routers_match. The call to start and stop the profiler happens in class Mage_Core_Controller_Varien_Front and method dispatch():

public function dispatch()

    Varien_Profiler::start('mage::dispatch::routers_match'); ////// profiler started here
    $i = 0;
    while (!$request->isDispatched() && $i++ < 100) {
        foreach ($this->_routers as $router) {
            /** @var $router Mage_Core_Controller_Varien_Router_Abstract */
            if ($router->match($request)) {
    Varien_Profiler::stop('mage::dispatch::routers_match'); ////// profiler stopped here


As you can see from the above, optimising that section of code is not going to be straightforward - if you follow the methods which run there is a lot of code which runs here. Also the reality is that what you have found in your profiler output is the time it takes for the framework to be initialised and then the request to run through the action methods code. These processes are extremely in depth and optimising them would require delving into the most complex workings of Magento framework with an end result of little to no improvement in speed, and probably a broken store unless you knew exactly what you were doing.

The bottom line is that Magento is a heavy configuration based MVC framework which requires a large number of resources to be collected and used for every request - and this just takes time. That's the down side, but the up side is that in return we get to work with a hugely capable piece of software which is intuitive to develop (once you know it well) and with which you can achieve anything you want - hence the huge number of extensions available.

So there are basically 2 things which take time with Magento, initialising the framework, and building the response, and these things can't realistically be optimised in code terms. These are pretty much the 2 areas you have found and so in order to improve their performance you need to be looking at your server hardware, being your hosting, as opposed to the codebase.


You can try out these steps:

  1. Enable query cache in mysql, it will help reduce query time.
  2. Enable All cache from cache management - use memcache/redis.
  3. Use full page cache like turpentine http://www.magentocommerce.com/magento-connect/turpentine-varnish-cache.html
  • very badly formatted question and an empty, useless response . – user2857 Nov 18 '14 at 13:07

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