[PATCH/RFC] On the iconview and the speed of directory listing.

David Faure dfaure at klaralvdalens-datakonsult.se
Mon May 26 11:55:00 CEST 2003


On Monday 26 May 2003 02:04, Maks Orlovich wrote:
> 
> > Oh, then what about calcRect first (but on the KIconViewItem), then
> > insertItem? Or does your updateItemContainer speedup mean that this isn't
> > necessary anymore?
> 
> Yes, that works, and no, it still makes a difference, although not as dramatic 
> - it makes slotNewItems go from 6.7 or so seconds to 3.5 or so seconds, as 
> far as I can see (measurements are kind of noisy). The difficulty is in doing 
> this cleanly, as we need to pass a view pointer to the calculations code 
> currently in calcRect(), and in that  KIconViewItem ctors are all inline, so 
> it can't do it itself.  (Unless some brave soul can come up with a way to 
> safely work with the old inline versions -- hmm, perhaps checking the 
> iconView() for being non-null will detect the old inline ctors being used? -- 
> worth trying, I guess). 

Another solution would be a factory method:
add a 
KIconViewItem* KIconView::newIconViewItem(...)  (or createIconViewItem?)
which does what we want (new with 0 as parent, then calcRect, then insertItem).

This means that the code needs to be ported to using that method instead
of new KIconViewItem, but that's a one-line change, and things remain
clean (at least not as hacky as having to cater for the inline constructors
being used in half the apps and not the other).

-- 
David Faure -- faure at kde.org, dfaure at klaralvdalens-datakonsult.se
Qt/KDE/KOffice developer
Klarälvdalens Datakonsult AB, Platform-independent software solutions


More information about the Kde-optimize mailing list