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

List:       kde-bugs-dist
Subject:    [Bug 307585] Sorting is too cpu intensive for big folders
From:       Mark <markg85 () gmail ! com>
Date:       2012-09-30 15:13:13
Message-ID: bug-307585-17878-qn1pUXvI1b () http ! bugs ! kde ! org/
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=307585

--- Comment #11 from Mark <markg85@gmail.com> ---
(In reply to comment #10)
> (In reply to comment #9)
> > The cleanest way is to overload KFileItem and add operator overloading for
> > the < operator.
> 
> I fail to see how you would tell such an overloaded operator about the sort
> role and sort order.

Well, qSort simply requires either an overloaded < operator to work or a public
function. It's one of the two :p
> 
> > So i'm tempted to do a dirty way now just to get it working.
> 
> Before you waste time on a dirty hack which cannot be included in Dolphin
> anyway, I recommend again to examine the git history. When you work on code
> that you think is not good, you should always find out first why the code is
> like it is. There might be a good reason for the design choices that is not
> obvious when you just look at the code.

I just did that and i couldn't find any reasoning for using this versus qSort.
When i look at the revision log it seems like the sorting progressed over time
to what it is now.

So i went on with my hack with the strong believe that it is simply faster.
I've got it working now and it works just fine even if you change the sorting.
This is feature complete, but 100% hacky and is really just a showcase to see
if qSort can be used. I didn't go for < overloading, but went for making all
required functions global public :)

The numbers for sorting?
Before: ~4.000.000.000 "cycles"
Now: ~3.000.000.000 "cycles"

That's quite a speedup, but still not enough. Of those cycles, ~2.600.000.000
are spend in KStringHandler::naturalCompare! That is not something i can speed
up. What might be possible is calling it less often. Right now that function is
called well over 1.800.000 times for a dataset of 100.000.

/me continues. These are the awesome bugs :)
The clean way to implement this would imho be recreating the
kfileitemmodelsortalgorithm.h class and putting all the functions and params in
there that i had to make public. That all is very sorting related so that would
clean it up rather nicely.

-- 
You are receiving this mail because:
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

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