[Zope3-dev] performance and BTrees

Marcus J. Ertl Marcus J. Ertl" <marcus.ertl@larp-welt.de
Thu, 01 May 2003 13:49:41 +0200


Hi!

I'm just playing around with the first version of my selfmade threaded
forum! I have added 20.000 messages in 2.000 threads.

If I want to show the first 20 threads of my board, I call following
methode:

    def messageList(self, start=0, end=20):
        """Returns a list of messages"""
        # optimzed by Christian Heimes
        items = [self._messageInfo(itm)
                    for itm in getAdapter(self.context,
IZopeContainer).items()
                        if ILNMessage.isImplementedBy(itm[1])
                ]
        items.sort(self._cmpDatesDown)
        return items[start:end]

But this takes to long! :-( It's even worse, if I try to view this
folder with it's 2.000 Threads, because it goes rekursivly in all
threads to count messages.
(Messages are folderish objects, holding the replies, and so on.)

So I have to problems:

1.) The normal admin-view
(http://gimli:8080/test/board/@@contents.html)  of a folder isn't good
for realy large folders. It realy takes for ever to build up!

2.) I had to optimize the messageList-methode!

I would like to cut down the list before going over it, before sorting
it. But I need to sort it by date, and filter out all not
ILNMessage-Objects, before I can take my slice out! Even worse: In near
future, there will be a filterstep more, because I had to add a
workflow!

Is there a way to tell OOBTree, I'm only interested in a slice of it's
.items()?

Bye
   Marcus

-- 
 Das LARP-Portal im Internet:
LARP-Welt: http://larp-welt.de

!fantasy