We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22303 MODX Staff
    • 10,725 Posts
    Quote from: Bruno17 at Mar 16, 2011, 08:38 AM

    may be its even better to use the If-snippet for conditionals like that.
    *ding!*
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      I always expected output filters to be faster since they don’t have to reach out to fetch snippets.. It’s somewhat seeing my religion falling apart in that comment Jason, lol.
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 22303 MODX Staff
        • 10,725 Posts
        Quote from: Mark at Mar 16, 2011, 09:55 AM

        I always expected output filters to be faster since they don’t have to reach out to fetch snippets.. It’s somewhat seeing my religion falling apart in that comment Jason, lol.
        Every piece of the output filter is evaluated based on order of tags, so it is always more efficient to do conditional checks in a single Snippet and return the output. That said, even using the If snippet in certain ways can be inefficient. I’m not trying to say you can’t use either efficiently; just pointing out things to consider.
          • 8489
          • 90 Posts
          I’m building with MODX Revolution 2.1.0-rc4 (traditional), the front-end is very slow 6/8 seconds for a page to load, when visiting the same page again the load time is under 1 second.

          I have 2 Templates, 25 TV’s, 24 chunks and 1000+ pages will be +3000 at the end (multilingual)

          Can someone please help me to find out what the cause is of the long page loads?
          I have included the System info.

          Thanks!

            • 33968
            • 863 Posts
            Which snippets are you running on those pages? If you are making Wayfinder and/or getResources go through all of those TVs for over 1,000 pages it will definitely slow things down. Wanna post your snippet calls here?

            If pages are loading in under a second next time around then the good news is they are at least being cached and the majority of your visitors won’t notice the performance hit.
              • 8489
              • 90 Posts
              Home page

              [[Wayfinder?
              &startId=`0`
              &outerTpl=`wfOuter`
              &rowTpl=`wfRow`
              &firstClass=``
              &lastClass=``
              &hereClass=`active`
              ]]
              


              outerTpl:

              <ul>[[+wf.wrapper]]</ul>
              


              rowTpl:

              <li><a href="[[+wf.link]]" title="[[+wf.title]]" class="[[+wf.classnames]]"><span>[[+wf.linktext]]</span></a></li>
              



              [[Wayfinder?
              &startId=`0`
              &outerTpl=`wfOuter`
              &rowTpl=`wfRowFooter`
              ]]
              


              rowTpl:
              <li><a href="[[+wf.link]]" title="[[+wf.title]]"><span>[[+wf.linktext]]</span></a></li>
              


              [[getResources?
              &parents=`6`
              &limit=`8`
              &showHidden=`0`
              &hideContainers=`1`
              &resources=`-7,-841,-847`
              &includeTVs=`1` 
              &tpl=`nieuwBinnengekomen`
              &sortby=`editedon`
              &sortdir=`DESC`
              ]]
              


              tpl nieuwBinnengekomen:

              <li><a href="[[~[[+id]]]]">[[+pagetitle]] [[+tv.automaatSchakelTaalDemontage]]</a></li>
              


              [[*one]]

              input options:

              @EVAL return $modx->runSnippet('getResources', array( 'parents'=>'11','hideContainers'=>'0','includeContent'=>'1','depth'=>'10','tpl'=>'listOne','context'=>'web','limit'=>'0', 'includeTVs'=>'1','processTVs'=>'1','sortby'=>'editedon','sortdir'=>'DESC'));
              


              tpl listOne:

              [[+pagetitle]]==
              <p class="titleBox"><a href="[[~[[+id]]]]">[[+pagetitle]]</a></p>
              <p class="modelBox">[[+tv.modelOne]]</p>
              <span class="fotobox"><img src="[[+tv.foto1One:phpthumbof=`w=200&h=100&f=jpeg`]]" alt="[[+pagetitle]]" /></span>
              <span class="prijsBox"><strong>[[+tv.valutaOne]] [[+tv.prijsOne]]</strong></span>
              <a href="[[~[[+id]]]]" class="meerinfo"><span>Meer informatie</span></a>
              ||
              


              [[*two]]

              input options:

              @EVAL return $modx->runSnippet('getResources', array( 'parents'=>'12','hideContainers'=>'0','includeContent'=>'1','depth'=>'10','tpl'=>'listTwo','context'=>'web','limit'=>'0', 'includeTVs'=>'1','processTVs'=>'1','sortby'=>'editedon','sortdir'=>'DESC'));
              


              tpl listTwo:

              [[+pagetitle]]==
              <p class="titleBox"><a href="[[~[[+id]]]]">[[+pagetitle]]</a></p>
              <p class="modelBox">[[+tv.modelNieuw]]</p>
              <span class="fotobox"><img src="[[+tv.foto1Two:phpthumbof=`w=200&h=100&f=jpeg`]]" alt="[[+pagetitle]]" /></span>
              <span class="prijsBox"><strong>[[+tv.valutaTwo]] [[+tv.prijsTwo]]</strong></span>
              <a href="[[~[[+id]]]]" class="meerinfo"><span>Meer informatie</span></a>
              ||
              



              [[*Three]]

              input options:
              @EVAL return $modx->runSnippet('getResources', array( 'parents'=>'13','hideContainers'=>'0','includeContent'=>'1','depth'=>'10','tpl'=>'listThree','context'=>'web','limit'=>'0', 'includeTVs'=>'1','processTVs'=>'1','sortby'=>'editedon','sortdir'=>'DESC'));


              tpl listThree:

              [[+pagetitle]]==
              <p class="titleBox"><a href="[[~[[+id]]]]">[[+pagetitle]]</a></p>
              <p class="modelBox">[[+tv.modelThree]]</p>
              <span class="fotobox"><img src="[[+tv.foto1Three:phpthumbof=`w=200&h=100&f=jpeg`]]" alt="[[+pagetitle]]" /></span>
              <span class="prijsBox"><strong>[[+tv.valutaThree]] [[+tv.prijsThree]]</strong></span>
              <a href="[[~[[+id]]]]" class="meerinfo"><span>Meer informatie</span></a>
              ||
              


              I will post sub pages tomorrow
                • 33968
                • 863 Posts
                Both Wayfinder and getResources are known to be quite resource intensive, especially getResources if you need to get TV values (will have to go through 25 TVs for each of your 1,000+ resources). You also have phpThumbOf rendering your thumbnails dynamically at the same time. Seems quite a lot for your server to do on initial page load undecided

                First, you can download and use the Executioner snippet to work out how long each of your snippet calls is taking to execute. That will give you an idea of where your problems are.

                It may be that you need to write a simple custom snippet to grab that [[+tv.automaatSchakelTaalDemontage]] field rather than getResources.
                And if you are listing hundreds of resources with your Wayfinder calls it will save a lot of time to limit those somewhat as well.

                Try Executioner first though smiley
                  • 3749
                  • 24,544 Posts
                  I don’t understand why you’re using all those @EVAL TVs rather than just putting the getResources tag in the page content or the template. The way you’re doing it, MODX has to get the TV, then parse it’s value, then call runsnippet(), which in turn calls getResources -- getResources has to get the TVs from all selected pages and process them and get the content, then process the Tpls, then return the results to runsnippet() which returns them to the TV -- then MODX has to replace the TV tag with the results returned from getResources. There’s a lot going on there. wink

                  You can use simple TVs for the property values in the tag if necessary, but the more you can avoid TVs, the faster the processing will be.

                  With that many TVs, you might want to consider a custom DB table to hold the information that’s now in the TVs.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 8489
                    • 90 Posts
                    Quote from: lucas at May 03, 2011, 12:35 PM

                    And if you are listing hundreds of resources with your Wayfinder calls it will save a lot of time to limit those somewhat as well.

                    Thanks Lucas, that was the problem I added &level=`1` to Wayfinder and now all the pages are loading lightning fast! even with all the TV’s, phpThumbOf and getResources.

                    Viva La Revolution!

                    MODx Revolution Extremely Slow
                    MODx Revolution Extremely Fast
                      • 8489
                      • 90 Posts
                      Quote from: BobRay at May 03, 2011, 12:46 PM

                      I don’t understand why you’re using all those @EVAL TVs rather than just putting the getResources tag in the page content or the template.

                      Thanks for your reply, I use @EVAL to let the costumer choose a resource with a dropdownlist from the manager to show the selected resource on home page for pruduct of the month etc.

                      But as you can read in the post above it had nothing to do with @EVAL, getresources or TV’s it was a missing &level=`1` in Wayfinder.

                      It is so fast now, extremely fast!