QMetaObject: don't use QMetaType::fromName() in typeFromTypeInfo()

The former will try to normalize the type name, but everything stored
in a QMetaObject is already in normalized form. So, if the first
lookup fails, the normalized one won't succeed either.

Use qMetaTypeTypeInternal(), which doesn't normalize.

At a minimum, this will fail faster. If we're lucky, the missing
round-trip via QMetaType(int).id() will help the positive case, too.
But if it does, it's lost in the statistical noise of the benchmark.

IOW: no measurable performance impact.

Pick-to: 6.9
Task-number: QTBUG-135572
Change-Id: I23834c201fbcd1780c50e85cf8a15ea5e4a94c74
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Marc Mutz 2025-04-08 15:10:29 +02:00
parent cac63042b1
commit a481a79a97

View File

@ -165,7 +165,7 @@ static inline int typeFromTypeInfo(const QMetaObject *mo, uint typeInfo)
{
if (!(typeInfo & IsUnresolvedType))
return typeInfo;
return QMetaType::fromName(stringDataView(mo, typeInfo & TypeNameIndexMask)).id();
return qMetaTypeTypeInternal(stringDataView(mo, typeInfo & TypeNameIndexMask));
}
static auto parse_scope(QByteArrayView qualifiedKey) noexcept