We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39177
    • 22 Posts
    I have a site with a number of big archives for blogs, publications, events and press releases. Each of these have over 200 posts which have been imported from an old evo site to a newly built site in Revolution 2.2.6 and each uses smart new Articles containers which are great for site admins.

    The beta site is: http://www3.centreforcities.org/

    The site has a number of getResources calls to list blog posts etc. The result is limited to the 12 most recent posts and mostly they look like this one from the homepage:
    [[getResources?
    							  &tpl=`blog_widget_tpl`
    							  &parents=`37`
    							  &limit=`10`
    							  &includeContent=`1`
    							  &includeTVs=`1`
    							  &showHidden=`1`
    							  &hideContainers=`1`
    							  &depth=`1`
    							  &tvPrefix=``
    							  &sortby=`{"publishedon":"DESC","createdon":"DESC"}`
    						  ]]

    The template these uses look like this:
    <li class="blog-preview">
                              <div class="clearfix"></div>
                            <div class="left">
                                <a href="[[~[[+id]]]]">
                                    <h4>[[+pagetitle:ellipsis=`80`]]</h4>
                                </a>
                                <a href="[[~[[+id]]]]" class="b-more">Read more</a>
                            </div>
                            <a href="[[~[[+id]]]]"><img src="[[+slide-image:default=`[[+thumbnail]]`]]" class="right post-img" /></a>
                            <div class="clearfix"></div>
    </li>


    The first time one of these loads it executes in 4.9891 s
    After caching this takes about a tenth of this time.

    Having two or more of these calls on one page push the inicial page loads over 15s.

    Is there any way to speed up these inicial calls by reducing the number of resources it searched through or pre-caching the getResources result? I am hesitant to move away from the Articles setup to break the articles down by year for instance, as this feels like a step back.

    Any help would be great!
      • 22840
      • 1,572 Posts
      Theres a few things you can do to reduce the time:

      Firstly you have include content in the call but I don't see the content tag so remove that
      Secondly, I have no idea what TV's you have on each page / article, but your processing every TV on every article get resources is running through, from the above code you only need the slide-image TV so limit the call to that and see if that makes any differance.

      [[getResources?
                                    &tpl=`blog_widget_tpl`
                                    &parents=`37`
                                    &limit=`10`
                                    &includeTVs=`1`
                                    &processTVs=`1` 
                                    &includeTVList=`1` 
                                    &processTVList=`slide-image` 
                                    &showHidden=`1`
                                    &hideContainers=`1`
                                    &depth=`1`
                                    &tvPrefix=``
                                    &sortby=`{"publishedon":"DESC","createdon":"DESC"}`
                                ]]

        • 39177
        • 22 Posts
        Quote from: paulp at Feb 15, 2013, 01:52 PM
        Theres a few things you can do to reduce the time:

        Firstly you have include content in the call but I don't see the content tag so remove that
        Secondly, I have no idea what TV's you have on each page / article, but your processing every TV on every article get resources is running through, from the above code you only need the slide-image TV so limit the call to that and see if that makes any differance.

        [[getResources?
                                      &tpl=`blog_widget_tpl`
                                      &parents=`37`
                                      &limit=`10`
                                      &includeTVs=`1`
                                      &processTVs=`1` 
                                      &includeTVList=`1` 
                                      &processTVList=`slide-image` 
                                      &showHidden=`1`
                                      &hideContainers=`1`
                                      &depth=`1`
                                      &tvPrefix=``
                                      &sortby=`{"publishedon":"DESC","createdon":"DESC"}`
                                  ]]


        Thanks Paul!

        It only seems to accept &includeTVList=`slide-image, thumbnail` rather than &includeTVList=`1`

        So the complete template looks like:

        [[getResources!
        							  &tpl=`blog_widget_tpl`
        							  &parents=`39`
        							  &limit=`10`
        							   &includeContent=`0`
        							  &includeTVs=`1`
        							  &processTVs=`1`
        							  &includeTVList=`slide-image, thumbnail`
        							  &processTVList=`slide-image, thumbnail`
        							  &showHidden=`1`
        							  &hideContainers=`1`
        							  &depth=`1`
        							  &tvPrefix=``
        							  &sortby=`{"publishedon":"DESC","createdon":"DESC"}`
        						  ]]


        That shaves about 3/4 off the execution time. Ideal!

        If anyone is look for a way to test indevidual snippet calls this snippet is great: http://www.jasoncoward.com/technology/2010/10/the-executioner-snippet.html

        And overall page load times: https://forums.modx.com/index.php?topic=62687.msg356209;topicseen

        Thanks again for your help Paul!
          • 22840
          • 1,572 Posts
          It only seems to accept &includeTVList=`slide-image, thumbnail` rather than &includeTVList=`1`


          Sorry my bad, was rushing through it but glad you got it working correctly smiley

          Also includeContent is set to 0 as default so you can remove that completely from the call