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.

Task-number: QTBUG-135572
Change-Id: I23834c201fbcd1780c50e85cf8a15ea5e4a94c74
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit a481a79a97c6e63a77cfae8a15e060e203afdc40)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2025-04-08 15:10:29 +02:00 committed by Qt Cherry-pick Bot
parent 95fd5fc0d2
commit 1f2565e96d

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