Greg Stark <gsstark@mit.edu> writes:
> Tom Lane <tgl@sss.pgh.pa.us> writes:
>> The results were
>> In C locale, SQL_ASCII encoding: 820 ms
>> In C locale, UNICODE encoding: 825 ms
>> Using Dawid's functions: 62010 ms
>> Stripped-down functions: 21010 ms
> I don't think these are fair comparisons though. The C locale probably
> short-circuits much of the work that strxfrm/strcoll have to do for other
> locales. I think the fair comparison is to compare a database initdb'd in a
> non-C locale like en_US using strcoll with no setlocale calls against one
> calling setlocale twice for every record.
OK, that's fair:In en_US locale: 1900 ms
which makes it only a factor of 20 slowdown to use setlocale every time...
regards, tom lane