use qBinaryFind instead of bsearch
authorKonstantin Ritt <ritt.ks@gmail.com>
Tue, 11 Jan 2011 13:12:01 +0000 (14:12 +0100)
committerOlivier Goffart <olivier.goffart@nokia.com>
Tue, 11 Jan 2011 13:12:01 +0000 (14:12 +0100)
commitb500b9f35fbeaa5f0fe8bfaf7b225518bf6e636f
treeddc7bc7e013343374c8ec3ee8260821c95624c22
parent540fbb2aec0e9187acd75598a050edf8929e1d68
use qBinaryFind instead of bsearch

depending on platform, qBinaryFind might be up to 3 times faster than bsearch
or a bit bit slower at the worst case; so why don't simply use qBinaryFind instead of bsearch and be an optimist? ;)

also we know that all color names are in the lower case already and thus
we can avoid lowercasing of them again and again, and again;
the name to find needs to be lowercased separately instead.

some color-by-name-lookup numbers:
before:
 0.000737 msecs per iteration (total: 3,684, iterations: 5000000)
after:
 0.000154 msecs per iteration (total: 771, iterations: 5000000)

Merge-request: 906
Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
src/gui/image/qxpmhandler.cpp
src/gui/painting/qcolor_p.cpp