KF5 Update Meeting Minutes 2013-w24
Frank Reininghaus
frank78ac at googlemail.com
Wed Jun 12 06:19:40 UTC 2013
Hi,
thanks for the explanation!
2013/6/12 Kevin Ottens:
> Hello,
>
> On Tuesday 11 June 2013 21:08:45 Frank Reininghaus wrote:
>> 2013/6/11 Kevin Ottens:
>> [...]
>>
>> > * ItemViews will be tier 2 until we contribute the natural compare to Qt;
>>
>> I thought that Qt 5.1 will have the QCollator class, which can perform
>> natural comparison of strings if you use "numeric mode"?
>
> Indeed, it's still private API though. Also the conclusion was "our
> implementation is better", but looking at QCollator I'm not sure I agree with
> that.
The disadvantage of KStringHandler::
naturalCompare(QString, QString)
is that it's very slow. When you open a directory with really many
files in Dolphin, this function is the main bottleneck.
The big advantage of QCollator is that it has a function
QByteArray QCollator::sortKey(const QString &string)
which lets you do the expensive stuff just N times for N items, and
then do O(N*log N) cheap comparisons of QByteArrays when you sort
them.
Regards,
Frank
More information about the Kde-frameworks-devel
mailing list