Opinions on KIO Slave side sorting? Possible GSoC project?

David Faure faure at kde.org
Thu Jan 8 08:14:14 UTC 2015


On Sunday 04 January 2015 21:37:21 Mark Gaiser wrote:
> Hi,
> 
> I was reading back an mailing list thread i started about half a year ago
> [1]. Later on in that thread Aaron suggested a cool idea of "slave side"
> sorting [2].
> 
> At that time i found it cool, but didn't really see a need for it. Dolphin
> is doing a fine job at sorting anyway, so why would we bother moving it to
> the KIO side. Well, a good reason for moving it to the KIO side just became
> apparent to me when looking at this RR [3]. Sorting is already quite
> complex in Dolphin. Adding in QCollator while also using threads makes it a
> bit more nasty since a QCollator object per thread is required (hence the
> RR).
> 
> Sure, the end result (and Dolphin is probably going to move there) is to
> use QCollatorSortKey which will make sorting quite a bit faster [4] and
> remove a QCollator requirement, but it won't be any cleaner. Quite the
> opposite, It will be more complicated due to the bookkeeping required to
> use QCollatorSortKey.

Moving complexity elsewhere doesn't make things less complex overall, though 
:-)

> All this sorting stuff is quite complicated and only available in Dolphin.
> Other people would need to duplicate it's efforts for the same results.
> That and considering that KIO is a framework that can be used by external
> (non KDE) parties made me think that having slave side sorting might be a
> very good thing to have. It would allow for performance optimizations that
> everyone can use and allows every KIO user to easily add sorting. It would
> completely remove a need for Dolphin to have sorting and would greatly
> simplify code that uses KIO.

This is an argument for doing sorting in KIO. Sure, why not.

But I don't see how it could be done slave-side. When using 
KDirModel/KDirLister the result of the directory listing is put into 
KDirListerCache and then reused from any view that wants to list that dir.
These views might have different sorting... What then?

Sorting in the slaves is mixing "core" and "gui" issues, IMHO. It's not the 
slave's job to know what kind of sorting the view wants.

In fact I see no advantage in implementing sorting on the slave side compared 
to sorting on the app side. If it's about not doing that in the app's main 
thread so it remains responsive, then threads are the alternative as you 
already noted.

I haven't looked into QCollator in details, but isn't there a way to make it 
threadsafe?

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list