We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5340
    • 1,624 Posts
    Hi,

    Here’s the output of the performance tags for one of my websites:

    Not Cached
    MySQL: 0.1035 s, 7 request(s), PHP: 17.9061 s, total: 18.0096 s, document retrieved from database.

    Cached
    MySQL: 0.0008 s, 0 request(s), PHP: 0.1995 s, total: 0.2003 s, document retrieved from cache.

    What’s weird is the first PHP time: 17.9061s. Any ideas on where to start and improve the time?
    The site has around 2000 pages and the cache file is 568kB.

    Thank You
      • 1343 ☆ A M B ☆
      • 2,213 Posts
      If you haven’t already try upgrading to Evo RC1 as there are some speed improvements for larger sites.
        Patrick | Server Wrangler
        About Me: Website | Tweets |  MODX Hosting
        • 5340
        • 1,624 Posts
        Thx AMDbuilder,

        I know about some of the improvements. I’ll try to integrate those changes directly into 0.9.6.3.
        I’ve done some hacks to the core and an upgrade is not feasible right now.

        Thx
          • 25663 MODX Staff
          • 12,272 Posts
          I’d be curious to know what hacks you’ve made to the core Cipa. What specifically did you address?
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 5340
            • 1,624 Posts
            See my signature. It’s a hack to define the start ID in of the document in the tree. I had made some changes to it lately but you’ll get the idea.

            I think I have one more but don’t remember which.
              • 22303 MODX Staff
              • 10,725 Posts
              Quote from: Cipa at Jun 28, 2009, 05:52 PM

              Not Cached
              MySQL: 0.1035 s, 7 request(s), PHP: 17.9061 s, total: 18.0096 s, document retrieved from database.
              The cache time looks fine; but what in the heck are you calling on that page that is making 18 seconds worth of SQL queries; Ditto??? That’s really bad. I would optimize whatever script is taking that long before worrying about cache optimization, as again, the cache times look fine.
                • 5340
                • 1,624 Posts
                I’m not sure

                I guess I have to time each snippet smiley. I’ll do some test later by removing snippet calls and see where the problem is.
                  • 5340
                  • 1,624 Posts
                  For one template this chunk seems to be the problem

                  <div id="leftMainMenu">
                      [[Wayfinder? &startId=`0` &includeDocs=`2124` &ignoreHidden=`TRUE` &outerTpl=`LeftMenuOuterTpl` &rowTpl=`LeftMenuRowTpl` &hereClass=`selected`]]
                      [[Wayfinder? &startId=`521` &includeDocs=`1336,1322,1173,2121` &ignoreHidden=`TRUE` &outerTpl=`LeftMenuOuterTpl` &rowTpl=`LeftMenuRowTpl` &hereClass=`selected`]]
                      <a href="[~1323~]">Part-Time Studies</a>
                      [[Wayfinder? &startId=`0` &includeDocs=`672,605,1331` &ignoreHidden=`TRUE` &outerTpl=`LeftMenuOuterTpl` &rowTpl=`LeftMenuRowTpl` &hereClass=`selected`]] 
                  </div>


                  I already asked on the wayfinder forum for a way to optimize this "strange" menu but I’ll post it here to. Maybe somebody gives me a solution.
                    • 1343 ☆ A M B ☆
                    • 2,213 Posts
                    Is there any chance you could share a link to the menu in question so we can get a better idea of what is being accomplished?
                      Patrick | Server Wrangler
                      About Me: Website | Tweets |  MODX Hosting
                      • 5340
                      • 1,624 Posts
                      Hi,

                      I ended creating my own snippet.

                      <?php
                      $docs = $modx->getDocuments(array(2124,1336,1322,1173,2121,672,605,1331), 1, 0, 'id,pagetitle,menutitle,menuindex', '', $sort= "menuindex", $dir= "ASC");
                      $output = '';
                      $use = '';
                      
                      foreach($docs as $doc){
                      	$selected = '';
                      	
                      	$use = $doc['pagetitle'];
                      	if($doc['menutitle']) $use = $doc['menutitle'];
                      	
                      	if($modx->documentIdentifier == $doc['id']){ $selected = 'class="selected"'; }
                      	
                      	$output .= '<a href="[~' . $doc['id'] . '~]" title="' . $use . '" ' . $selected . '>' . $use . '</a>';
                      	
                      	//add custom item after 2121
                      	if($doc['id'] == 2121){
                      		$output .= '<a href="[~' . 1323 . '~]" title="Part-Time Studies">Part-Time Studies</a>';
                      	}
                      }
                      
                      return '<div id="leftMainMenu">' . $output . '</div>';
                      ?>


                      Not sure why Wayfinder would take so long to do it. This snippet is 100 times faster than previous solution