[Development] Faster locale aware string list sorting

Zeno Endemann zeno.endemann at googlemail.com
Sun Mar 10 14:50:06 CET 2013

Hm, after checking with valgrind it seems my benchmark is spending most
of the time in the QCollator constructor and not actually collating
strings, so simply using the QCollator API once it is public might
indeed solve the problem (why is constructing so slow though?). At least
I would recommend not constructing a new QCollator on every
localeAwareCompare call but to cache one instance.

It might still make sense to develop a more specialized sorting
algorithm, the ICU documentation (sort key section) suggests this for
larger lists of strings. But if the problem is not as bad as I thought,
there is probably no need to add it to Qt itself.


Zeno Endemann wrote on 10.03.2013 12:40:
> Come to think of it, hasn't Qt always used ICU under Linux? But yes,
> I've tested Qt 5.0.1. Still it would be great if someone could confirm
> my findings, so I've uploaded the benchmark:
> https://bugreports.qt-project.org/browse/QTBUG-30126
> Regards,
> Zeno
> Thiago Macieira wrote on 10.03.2013 05:32:
>> On sábado, 9 de março de 2013 20.57.09, Zeno Endemann wrote:
>>> So my questions: Is there interest in (or even plans for)
>>> something like this? Also, I can hardly believe I'm the first to
>>> do something about this. Does anyone know of a library that deals
>>> with the problem already?
>> First of all, were you testing Qt 5? If it was with Qt 4, was that
>> an ICU build?
>> If not, all your benchmarks are useless.
>> _______________________________________________ Development mailing
>> list Development at qt-project.org 
>> http://lists.qt-project.org/mailman/listinfo/development

More information about the Development mailing list