[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: for kmail people: a discussion of mail summary files
From:       Matthias Kalle Dalheimer <kalle () dalheimer ! de>
Date:       2000-05-16 6:29:45
[Download RAW message or body]

Don Sanders wrote:
> 
> > Something that takes up a lot of time in KMail when showing a
> > list of message headers (if not taiking up the most time) is the cost of
> > operator new.
> 
> I've never managed to communicate this problem to anyone else before so maybe I
> should spend some extra time to try to make this clear. When creating a large
> number of objects The cost (timewise) of allocating memory for an object and
> calling its constructor is often relatively large.
> 
> I tried to reduce this cost in KMail by reusing existing objects. In technical
> literature (Design Patterns by the Gang of Four) this technique is know as the
> "Flyweight".
> 
> If I have time I will port kmheaders.cpp and kmfolder.cpp over to using the
> flyweight pattern for KMHeaderItems (derived from QListViewItems) and for
> KMMsgInfo objects.

Creating QListViewItems themselves is pretty cheap (they do not even
inherit from QObject), so the problem is probably in operator new
itself. IIRC, Waldo wrote a new allocator for classes that need to
allocate a lot of small objects, perhaps you can use that one?

Kalle

-- 
Kalle Dalheimer     Contract programming for Unix
kalle@dalheimer.de  Technical writing
kalle@kde.org       Technical editing
kalle@oreilly.de    KDE Developer (MFCH)
mdalheimer@acm.org  It's open, it's source, it runs - must be KDE!
	
Lukashenko and the Pope - the last remaining dictators in Europe.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic