QTextMarkdownWriter: reduce unnecessary relocations

Instead of a static constexpr QL1SV object (which force the compiler
to allocate storage and therefore causes relocations), use a mere
automatic constexpr object (which doesn't). There never was a need to
make this object static, as constexpr is enough to force the compiler
to constant-fold them.

Difference:
  qtextmarkdownwriter.cpp.o:
- 0000000000000000 l     O .data.rel.ro.local     0000000000000010 maybeEscapeFirstChar(QString&)::specialFirstCharacters
  0000000000000000 l    d  .data.rel.ro.local     0000000000000000 .data.rel.ro.local

See
  https://stackoverflow.com/questions/19067010/finding-where-relocations-originate/19338343#19338343
for the script to generate this output.

See https://www.akkadia.org/drepper/dsohowto.pdf Section 1.6 for why
we care.

As a drive-by, port from QL1SV to _L1 UDL.

Amends ca4774131b9b8ee40b4d7f5c1ba296af4700207f.

Pick-to: 6.8
Task-number: QTBUG-100536
Change-Id: I31e124962e03b8b40df9153b09f627e8e22a8119
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit db6f8821fcf0028f83b4c27c8de2399c99577272)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2025-03-06 12:04:39 +01:00 committed by Qt Cherry-pick Bot
parent 55fadd025b
commit a069569ea2

View File

@ -298,7 +298,7 @@ static int adjacentBackticksCount(const QString &s)
static void maybeEscapeFirstChar(QString &s) static void maybeEscapeFirstChar(QString &s)
{ {
static const QRegularExpression numericListRe(uR"(\d+([\.)])\s)"_s); static const QRegularExpression numericListRe(uR"(\d+([\.)])\s)"_s);
static const QLatin1StringView specialFirstCharacters("#*+-"); constexpr auto specialFirstCharacters = "#*+-"_L1;
QString sTrimmed = s.trimmed(); QString sTrimmed = s.trimmed();
if (sTrimmed.isEmpty()) if (sTrimmed.isEmpty())