summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/kernel.pri
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2010-02-26 13:13:41 (GMT)
committerKent Hansen <kent.hansen@nokia.com>2010-02-26 13:15:24 (GMT)
commit7ce54e9cc4b35d16c32f4dfc5875038797731f2f (patch)
treed5c7e0a656e6bdb1a040d06deed2132cad5c2551 /src/corelib/kernel/kernel.pri
parent68c02d299f0e423582d34169b3d4597d179a53a2 (diff)
downloadQt-7ce54e9cc4b35d16c32f4dfc5875038797731f2f.zip
Qt-7ce54e9cc4b35d16c32f4dfc5875038797731f2f.tar.gz
Qt-7ce54e9cc4b35d16c32f4dfc5875038797731f2f.tar.bz2
Improve lookup speed of QMetaType::type() for normalized types
Two improvements are made: 1) Store the length of the built-in types to avoid calling strcmp() when there's no way the types will match; and 2) Speculate on the input already being normalized. When the type name is already in normalized form (which we believe to be the common case), normalizing is wasteful (allocating a bytearray that's going to contain exactly the same string as the original input). Use the same pattern as used in QObject::connect(), which speculates on the signature already being normalized; only if the lookup fails, the signature is normalized and looked up again. For the QMetaType::builtinTypes benchmark, this improves performance by roughly 4x. For the QMetaType::builtinTypesNotNormalized benchmark, the performance is half of that before, because the lookup is done twice. But we choose to optimize for the already-normalized case. This makes a big difference in the QtScript QObject bindings, for example. Reviewed-by: Harald Fernengel
Diffstat (limited to 'src/corelib/kernel/kernel.pri')
0 files changed, 0 insertions, 0 deletions