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

List:       kde-commits
Subject:    KDE_3_1_BRANCH: kdelibs/kdeui
From:       Scott Wheeler <wheeler () kde ! org>
Date:       2003-09-03 11:22:19
[Download RAW message or body]

CVS commit by wheeler: 

Backport.  Original log:

Here's a pretty significant speed improvement that takes an "n" out of
the time it takes to paint a listview.  This is very noticeable on
large lists where rendering the list is very time consuming.  This still
isn't as fast as painting QListViewItems, probably because itemBelow()
isn't as fast as it ideally would be, but it's a big step in the right
direction.

Here's the text from the long comment in the code:
--
Ok, there's some weirdness here that requires explanation as this is a
speed hack.  itemAbove() is a O(n) operation (though this isn't
immediately clear) so we want to call it as infrequently as possible --
especially in the case of painting a cell.

So, in the case that we *are* painting a cell:  (1) we're assuming that
said painting is happening top to bottem -- this assumption is present
elsewhere in the implementation of this class, (2) itemBelow() is fast --
roughly constant time.

Given these assumptions we can do a mixture of caching and telling the
next item that the when that item is the current item that the now
current item will be the item above it.

Ideally this will make checking to see if the item above the current item
is the alternate color a constant time operation rather than 0(n).

CCMAIL:coolo@kde.org


  M +58 -5     klistview.cpp   1.185.2.10
  M +3 -1      klistview.h   1.92.2.3



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

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