naturalCompare Qt5 task

Aleix Pol aleixpol at kde.org
Fri Jul 19 11:39:42 UTC 2013


On Fri, Jul 19, 2013 at 1:27 PM, Frank Reininghaus <frank78ac at googlemail.com
> wrote:

> Hi,
>
> 2013/7/19 Aleix Pol:
> > Hi,
> > I was looking at that task in the Qt5 epics list and I didn't understand
> it
> > fully.
> >
> > contribute natural-comparison to Qt5 (see KStringHandler). In Qt there is
> > naturalCompare function but private and not as good as from
> KStringHandler.
> > Thiago says: add the feature to QCollator.
>
> Could you explain why KStringHandler::naturalCompare() is better than
> what QCollator offers?
>
> QCollator has the very nice feature
>
> QByteArray QCollator::sortKey(const QString &string)
>
> which allows to calculate the 'sortKey' for each string once, and then
> use these for the sorting. This means that we could sort a large list
> of strings with O(N*log(N)) cheap comparisons of QByteArrays, rather
> than the same amount of very expensive
> KStringHandler::naturalCompare() calls.
>
> At the moment, KStringHandler::naturalCompare() is the major
> bottleneck in Dolphin when you open a very large directory. If we
> could use QCollator, that problem could be solved quite easily.
>
> Cheers,
> Frank
>

Hi,
I was just the task explaination [1]...

Aleix

[1] http://community.kde.org/Frameworks/Epics/Contributions_to_Qt5
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20130719/a2bd153d/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list