[Development] Faster locale aware string list sorting

Zeno Endemann zeno.endemann at googlemail.com
Sat Mar 9 23:09:31 CET 2013


Well, I have benchmarked this using Qt 5.0.1 which is already using the
ICU library, so this alone does not solve the problem. And as far as I
can tell the QCollator class more or less just wraps the ICU api. I
couldn't find any plans to develop a sorting algorithm for *lists* of
strings on top of this...

By the way, if the api of QCollator will be exactly as described in the
blog post, it does not expose the ICU api for partial sort keys
(http://userguide.icu-project.org/collation/api#TOC-Obtaining-Partial-Sort-Keys)
which should be quite useful for developing such an algorithm.

Regards,
Zeno

Qi Liang wrote on 09.03.2013 21:09:
> And we have a blog from Denis about that:
> http://blog.qt.digia.com/blog/2011/06/14/string-collation-with-locales/
> 
> Regards,
> Liang
> 
> On 3/9/13 8:59 PM, "Knoll Lars" wrote:
> 
>> There's a QCollator class in Qt already to fix exactly that problem, the
>> plan is to make it public for Qt 5.1.
>>
>> Cheers,
>> Lars
>>
>> On 3/9/13 8:57 PM, "Zeno Endemann" <zeno.endemann at googlemail.com> wrote:
>>
>>> I've been playing around with different sorting methods and have noticed
>>> that the naive way to sort a QStringList with localeAwareCompare is
>>> atrociously slow on my system (64bit Linux, German locale - up to a
>>> thousand times slower than using the lessThan-operator). While a
>>> locale aware sorting is obviously inherently slower than basically a
>>> memory compare I believe we can do a lot better.
>>> ...
>>> Best regards,
>>> Zeno Endemann




More information about the Development mailing list