We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I’m having an ’issue’ with includeTVs and getResources.

    I’m generating a listing of 8 pages using getResources. Each listing-item has pagetitle + introtext + an image TV. So as usual I use &includeTVs=`1` to generate the listing, so that I can call the TV using tv.ImageTV.

    This all works as expected but I’m a bit worried about performance. This listing takes 0.4 to 0.5 seconds to generate on the server (an old P4 3 ghz with ubuntu+zendserver). This is all uncached. 5 refreshes results in this loadtime:
    0.5303 s
    0.5302 s
    0.4268 s
    0.5308 s
    0.4265 s

    If I turn includeTVs off this results in the image not displaying and reducing the loadtime:
    0.1413 s
    0.1426 s
    0.1421 s
    0.1429 s
    0.1432 s

    A big difference. Since I still want the image to show, I figured I could try getResourceField for getting the image. So, I’ve still have includeTVs off and use [[!getResourceField? &id=`[[+id]]` &isTV=`1` &field=`ImageTV`]]. This results in the following loadtime:
    0.3163
    0.3285
    0.3161
    0.3148
    0.3160

    This is considerably faster than the includeTVs=1 version. I guess the difference is in the whole parsing mechanism which is included in the includeTVs function. Just wanted to let anyone know that getResourceField might enhance your performance when you only need one TV.

    For us this is rather important, because we have around 9 getResources-calls on one page for generating an accordion listing. All those 0.2 seconds really add up when this amount of calls are involved.
      Sterc Internet & Marketing | MODX Founding Partner | Chairman of the MODX Advisory Board

      In need of a MODX consult? Try our MODX Developers Experts!
      • 33337
      • 3,975 Posts
      Thanks for sharing. Do you have numbers from multiple TVs? say 5 or more etc.
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link
      • I’ll do a test to see where the breaking point is. That will be a bit later this week, because this particular project is taking all my time at the moment.
          Sterc Internet & Marketing | MODX Founding Partner | Chairman of the MODX Advisory Board

          In need of a MODX consult? Try our MODX Developers Experts!