I know that for performance it's good practice to use nocall
on a <tal:condition>
in order to avoid calling an object. Would appreciate (links to) a bit of background as this sounds a little vague to me :-)
So when do you use nocall? Can it hurt to put it on all my conditions?
Thanks !
I tend to use tal:condition="python: variable" instead. That way I can always write normal proper Python expressions, without having to fear magic behavior from the default path expressions.
Path expressions will do a number of things, for example call the variable in the expression if it is callable. Often you deal with tools or content items in TAL, which are all callable.
The most common mistake is to use a tal:condition="content_object". The content object might come from a number of API's, for example calling any kind of reference field will return content objects. Catalog searches will return "brains" but in listings you often need to access more attributes of these, so you have a tal:define="obj brain/getObject".
Calling a content object causes the object to be rendered as if a browser would have requested it. As rendering pages usually takes between 500ms and 2 seconds, you make rendering your page slower by that amount of time. If you do this in a loop over 25 items, I'd expect the page to take 30 seconds or more to render.