From e744561c3594ff8bf39ce857c391e87c9f4cbfcf Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 6 Mar 2025 12:04:39 +0100 Subject: [PATCH] QFontEngine: reduce unnecessary relocations Instead of static constexpr QL1SV objects (which force the compiler to allocate storage for them and therefore cause relocations), use mere automatic constexpr objects (which don't). There never was a need to make these objects static, as constexpr is enough to force the compiler to constant-fold them. Difference: qfontengine.cpp.o: - 0000000000000040 l O .data.rel.ro.local 0000000000000010 QFontEngine::findGlyph(QLatin1String) const::gid - 0000000000000000 l O .data.rel.ro.local 0000000000000010 QFontEngine::findGlyph(QLatin1String) const::uni 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. Amends 176816f21324bf736389037c62538a25f2522808. Task-number: QTBUG-100536 Change-Id: I3cdf42c9758ec32654b378a2b27b565a6c92c26b Reviewed-by: Volker Hilsheimer Reviewed-by: Anton Kudryavtsev (cherry picked from commit 511ee39570a104d07eb4c9fb0d8a8fb775e9b38a) Reviewed-by: Qt Cherry-pick Bot --- src/gui/text/qfontengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index d33965b5ea1..e284673d9e7 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -949,8 +949,8 @@ glyph_t QFontEngine::findGlyph(QLatin1StringView name) const #endif if (!result) { - static constexpr auto gid = "gid"_L1; - static constexpr auto uni = "uni"_L1; + constexpr auto gid = "gid"_L1; + constexpr auto uni = "uni"_L1; if (name.startsWith(gid)) { bool ok; result = name.slice(gid.size()).toUInt(&ok);