PATCH SlaveBase::listEntry() faster dir listing

aleXXX alexander.neundorf at gmx.net
Tue May 28 21:26:03 BST 2002


On Sunday 26 May 2002 10:22, Stephan Kulow wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Sonntag, 26. Mai 2002 03:06, aleXXX wrote:
> > Hi,
> >
> > I noticed that when changing with konqy into qt-copy/doc/html, sorting
> > the dir once takes 2.2 seconds. It gets sorted after every chunk of
> > incoming file items. Sometimes it happens that I get 1100 items at once
> > (i.e. 2.2 seconds sorting) and then the rest of 150 item in the second
> > chunk (again 2 seconds sorting).
> > So I tuned the calculation of listEntryCurrentSize a little bit so that
> > this shouldn't happen anymore (at least less probably).
> > I check whether all remaining items may arrive within maximum_updatetime,
> > if this is true, listEntryCurrentSize is set big enough to take them all.
> > If we are below min_updatetime, I calculate how much items might arrive
> > within min_updatetime and take twice as much (200 ms is still fast
> > enough).
> >
> > The patch makes e.g. listing of qt-copy/doc/html on my system noticable
> > faster. It assumes that totalSize() is always  called before the first
> > listEntry().
> >
> > Bye
> > Alex
> >
> > (the patch also contains the changed signal handler)
>
> Which didn't make it easier to read. Can't you take out such patches before
> you make new ones?
>
> Anyway: There once was code in kfile that did the sorting a bit different
> than what it's now. It sorted the chunk (e.g. the 150 items) and then used
> a merging algorithm to get the new chunk in the whole list instead of
> sorting the new list from scratch. But I guess you only notice the
> difference if you have 7000 instead of the 1200 items. For the 1200 items
> (and problably quite some other cases), your patch helps anyway, so I think
> you should commit (the listing part :)

Ok will do.

> Greetings, Stephan

Yes, even better would be some mega-clever sorting, which sorts only the 
items which *have* to be sorted at the moment (i.e. the items which are 
visible). The rest has only to be divided into less than and greater than, 
which could happen in slotNewItems(), where we already iterate through the 
whole list. Then we insert the part which will be displayed in the listview 
(so, maybe 200 items would have to be sorted at most). Maybe the sorting 
could even be done in a 0-timer, or a thread now that we have them.

Bye
Alex




More information about the kde-core-devel mailing list