qt5base-lts/tests/benchmarks/corelib
Thiago Macieira c250a0ec3a Unify and optimize QByteArray::to{Upper,Lower}
Do a check first if we need to transform before doing the transform.
This means we won't detach when transforming data that is already
correct.

And instead of using QChar, use our own hand-rolled table. In a proper
LTO build, the QChar calls would be resolved to a lookup of the Unicode
data, but not many people do LTO builds, Therefore, this means a great
speed-up is achieved by simply avoiding the function call. The extra
gain in performance comes from the simpler translation table instead of
the more complex full-Unicode data.

Also as a consequence, this changes the handling of two characters in
Latin 1: 'ß' should be uppercased to "SS" but we won't do it, and 'ÿ'
can't be uppercased in Latin 1 ('Ÿ' is outside the range).

Benchmarking is included. Comparing the Qt 5.4 algorithm to the new code
is almost 20x faster. Other alternatives are included in the benchmark
and are all faster than the current code, though slower than the new
one. While all of them could compress the tables to be smaller or shared
between uppercasing and lowercasing, they would also expand to more code
(though probably less than the extra bytes required in the full
translation table). In the trade-off, I decided to go with simplicity
and most efficient code.

Change-Id: I002d98318d236de0d27ffbea39d662cbed359985
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2014-08-19 03:39:05 +02:00
..
codecs Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
io Merge remote-tracking branch 'origin/stable' into dev 2013-11-26 22:35:48 +01:00
json Fix int conversion to string 2014-08-08 10:45:53 +02:00
kernel Remove useless QMetaType benchmarks 2014-07-28 08:39:29 +02:00
mimetypes Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
plugin Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
thread Merge remote-tracking branch 'origin/stable' into dev 2013-11-26 22:35:48 +01:00
tools Unify and optimize QByteArray::to{Upper,Lower} 2014-08-19 03:39:05 +02:00
corelib.pro test: Moving tst_QMimeDatabase::inheritsPerformance() test 2012-10-31 19:56:42 +01:00