QString: add Q_NEVER_INLINE for ucstricmp()
Case-insensitive comparisons are not common, but both GCC and Clang inlined the ucstricmp() functions into QtPrivate::compareStrings(), with the side-effect that a lot of unnecessary setup code saving CPU registers was executed in the prologue of those functions. After this, Clang 13 emits both compareString() functions without any push/pop to save registers on x86-64; GCC 11 still emits a few, but fewer than before (it's emitting some unnecessary overhead for the loops). Change-Id: I0e5f6bec596a4a78bd3bfffd16c8fc2c0be9165f Reviewed-by: Marc Mutz <marc.mutz@qt.io>bb10
parent
ba0864ae52
commit
2c2e2a67c3
|
|
@ -1006,7 +1006,7 @@ void qt_to_latin1_unchecked(uchar *dst, const char16_t *src, qsizetype length)
|
|||
}
|
||||
|
||||
// Unicode case-insensitive comparison
|
||||
static int ucstricmp(const QChar *a, const QChar *ae, const QChar *b, const QChar *be)
|
||||
Q_NEVER_INLINE static int ucstricmp(const QChar *a, const QChar *ae, const QChar *b, const QChar *be)
|
||||
{
|
||||
if (a == b)
|
||||
return (ae - be);
|
||||
|
|
@ -1036,7 +1036,7 @@ static int ucstricmp(const QChar *a, const QChar *ae, const QChar *b, const QCha
|
|||
}
|
||||
|
||||
// Case-insensitive comparison between a Unicode string and a QLatin1String
|
||||
static int ucstricmp(const QChar *a, const QChar *ae, const char *b, const char *be)
|
||||
Q_NEVER_INLINE static int ucstricmp(const QChar *a, const QChar *ae, const char *b, const char *be)
|
||||
{
|
||||
auto e = ae;
|
||||
if (be - b < ae - a)
|
||||
|
|
@ -1058,7 +1058,7 @@ static int ucstricmp(const QChar *a, const QChar *ae, const char *b, const char
|
|||
}
|
||||
|
||||
// Case-insensitive comparison between a Unicode string and a UTF-8 string
|
||||
static int ucstricmp8(const char *utf8, const char *utf8end, const QChar *utf16, const QChar *utf16end)
|
||||
Q_NEVER_INLINE static int ucstricmp8(const char *utf8, const char *utf8end, const QChar *utf16, const QChar *utf16end)
|
||||
{
|
||||
auto src1 = reinterpret_cast<const uchar *>(utf8);
|
||||
auto end1 = reinterpret_cast<const uchar *>(utf8end);
|
||||
|
|
|
|||
Loading…
Reference in New Issue