[Zope] Optimisation fun and games

Stefan H. Holek stefan@epy.co.at
Mon, 20 May 2002 12:35:11 +0200


--On Montag, 20. Mai 2002 11:09 +0200 Hannu Krosing <hannu@tm.ee> wrote:

> <dtml-in> is also a thing to avoid if possible - in a test portal front
> page implementation I rewrote 3 instances of
>
>
> <dtml-in "subfolder.objectValues()">
> <tr>
>  <td>
>  <a href="sisu/<dtml-var id>"><dtml-var title_or_id></a>
>  <dtml-if is_admin><dtml-var "muuda_link(id)"></dtml-if>
>  </td>
> </tr>
> </dtml-in>
>

Your problem is objectValues *not* dtml-in. The way you do it, all listed 
objects are actually accessed, which means loaded into memory and such. 
*Always* use ZCatalogs for listings like the above!

7. Use catalogs whenever possible. It is even reasonable to catalog results 
from external sources like RDBMS (ZSQLMethods).

HTH,
Stefan

--
BLOWFISH, n. - Preference for beef