[Zope] python script ques

Oliver Bleutgen myzope@gmx.net
Wed, 12 Jun 2002 12:04:52 +0200


Michal Bencur wrote:
> Hi Oliver,
> 
> I don't know how Catalog works, but:
> 
> I believe that using objectIds() cause getting all Ids
> into array into memory, and when using Catalog, you only
> access a BTree and don't iterate over all of it's values,
> but only until Catalog finds object with such id/attribute.
> 
> because of this using Catalog should require loading less
> data, less memory required, so it should be faster I guess.
> 
> I know nothing about internals of Catalog, so fix me if I'm
> wrong please.


Hi Michal,

about Zcatalog, ME2 ;-).

What I wanted to make clear is that we talked about basically 3 
different methods to get infos about subobjects of a Folder -
ojectIds(), objectValues or via ZCatalog (ok, there is a forth, 
btreefolders)
You are right that there are performance considerations which have to be 
done, the question is the quantity of subobjects where these 
considerations come into play.

Just to pull some numbers out of my hat:

objectIds(): gives back a list of strings, filtered out from a tuple of 
dictionaries.
Shouldn't give problems for < 1000 objects, and in normal cases not for 
even more objects IMO (remember, out of my hat).

ObjectValues(): gives back a list objects, uses objectIds to find the 
Ids and "wakes up" the objects pertaining to these Ids.
I wouldn't do that for much more than 10 objects without thinking about 
it. This heavily depends on the circumstances, though.
This cleary should be alot slower and memory intensive (and I/O 
intensive) than objectIds.

Zcatalog: well, seems to be most scalable, but again, there's also the 
Btreefolder.

If someone could give better founded number, I'd be glad to hear them.


cheers,
oliver