KFileItem optimization

Fredrik Höglund fredrik at kde.org
Mon Jan 5 00:08:15 CET 2009


On Sunday 04 January 2009 13:30, Jakub Stachowski wrote:
> Dnia Saturday 03 January 2009, Jakub Stachowski napisał:
> > Hello,
> [ ... ]
> 
> >  Another possible optimization: for each item, KFileItemDelegate checks
> > actual size of file icon. Is this really necessary? Or maybe it would be
> > enough to check size for first icon in the view and then reuse it.
> 
> Some more checking shows that for given decoration size (stored in 
> option.decorationSize), actual icon size is always the same - one of  the 
> common sizes like 64x64, 256x256 etc.
> Caching the size makes laying out items about 20% faster (on top of previous 
> patch).
> KFileItemDelegate objects are not created in great numbers (one per view), so 
> adding two QSize fields will not have any effect on memory usage.

Hi Jakub,

Unfortunately that assumption isn't true when previews are enabled.
KFileItemDelegate::sizeHint() used to rely on option.decorationSize and
never load the icon, but that optimization didn't work because
of that reason.

I'm CC'ing Peter Penz in case he has something to add, because if my
memory serves me right he did the original analysis of that issue.

Regards,
Fredrik



More information about the Kde-optimize mailing list