Alex E. Schneider

Which asset loop is faster?

Vote 0 Votes

In an Entry archive template, I use mt:Assets to retrieve assets with one or more tags. Those assets (images) are always related to the Entry in context. I would like to know if the process of looping over all assets is slower compared to using the mt:EntryAssets container tag. With other words, is there something about the mt:EntryAssets tag that makes it faster at finding associated (embedded) images?

As the library of assets grows larger and larger over time, I am thinking that a retrieval by tag may strain the system. Probably that's nothing I have to worry about, but some facts or opinions on this would be welcome.

Reported on Movable Type 4.2

2 Replies

| Add a Reply
  • It will be much slower because <mt:Assets> does not pick up the context of the <mt:Entries> container. To see what I mean, just try:

    <mt:Entries lastn="50">

    <mt:EntryTitle/><br/>

    <mt:Assets>

    <mt:AssetURL/>

    </mt:Assets>

    </mt:Entries>

    in an index template. The output will be quite huge.

  • Thanks - that's what I mean. Well I guess I'll bear that cost though, because assignment by tag is so amazingly flexible. Should the design change, thumbs can be recreated in a snap. In contrast, after embedding an image, I am stuck with it (and its corresponding thumbnail), unless I use a regex on mt:EntryBody.

    Still weighting my options...

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

1774 6167

Last Topic: Template modules by Zielun on Feb 16, 2012

86 302

Last Topic: website entries by masoud on Oct 26, 2011

1434 5088

Last Topic: Maintenance announcement by Nick on Feb 17, 2012

695 2912

Last Topic: Insert Image / File Fails by Russ Miller on Feb 10, 2012

84 291

Last Topic: How to have some other characters in entry basename automatically written by Afshin Haghighatnia on Dec 22, 2011

174 740

Last Topic: Captcha images rendering slowly by ScottM on Feb 12, 2012

190 568

Last Topic: Analytics Reporting by michael webster on Feb 5, 2012

48 210

Last Topic: An idea and also a request by Afshin Haghighatnia on Jun 29, 2011

64 246

Last Topic: jQuery in MT 5.1 still at 1.4 - why? by perlmonkey on May 25, 2011

code.sixapart.com

137 478

Last Topic: Getting a thumbnail with xpath by Peter on Mar 13, 2011

222 720

Last Topic: Custom Field for Asset Not Appearing by android on Feb 9, 2012