[Zope] Slicing a lazy sequence

Miles miles at jamkit.com
Tue Oct 30 15:45:31 EDT 2007


Hi,

I'm looking at a performance issue with a site.  Part of the problem 
seems to be the time taken to load all the attributes to construct a 
large number of brain objects.

I think I remember reading somewhere once that if you slice a sequence 
of catalog results as follows:

rs = portal_catalog.searchResults(portal_type='my_type')
return rs[10:30]

or even

<dtml-in "portal_catalog.searchResults(portal_type='my_type')" start=10 
size=20>

that this "undoes" the advantage of the lazy sequence, as it has to 
iterate over all the items in the sequence to produce the slice.

Is this correct or have I just imagined it - can anyone confirm?!  And 
if I haven't imagined it, how can I do this more efficiently?

Thanks,

Miles



More information about the Zope mailing list