New qHash algorithm for uchar/ushort arrays (QString, QByteArray, etc.)
authorGiuseppe D'Angelo <dangelog@gmail.com>
Tue, 27 Mar 2012 17:40:06 +0000 (18:40 +0100)
committerQt by Nokia <qt-info@nokia.com>
Mon, 9 Apr 2012 08:16:09 +0000 (10:16 +0200)
commit4893a5422e2978f4b9a0e7785af1696e3438ac22
treecef483fbe83435e154d91f739b1667bb1cbf34ba
parentddb70bee2fd323ddc4273aec5d40d975f50d2904
New qHash algorithm for uchar/ushort arrays (QString, QByteArray, etc.)

Port of Robin's work from I0a53aa4581e25b351b9cb5033415b5163d05fe71
on top of the new qHash patches (the original commit just introduced
lots of conflicts, so I redid it from scratch).

This is based on the work done in the QHash benchmark over the past
few months experimenting with the performance of the string hashing
algorithm used by Java.

The Java algorithm, in turn, appears to have been based off a
variant of djb's work at http://cr.yp.to/cdb/cdb.txt.

This commit provides a performance boost of ~12-33% on the
QHash benchmark.

Unfortunately, the rcc test depends on QHash ordering.
Randomizing QHash or changing qHash will cause the test to fail
(see QTBUG-25078), so for now the testdata is changed as well.

Done-with: Robin Burchell
Change-Id: Ie05d8e21588d1b2d4bd555ef254e1eb101864b75
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
src/corelib/tools/qhash.cpp
tests/auto/tools/rcc/data/images/images.expected