From 348911a4e7e3ded28fd1f73a8270e48198e131f9 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Sat, 17 Dec 2022 11:43:14 +0200 Subject: [PATCH] RCCFileInfo: use QString prepend optimization Instead of using QStringBuilder (which always allocates a new QString to hold the result of the concatenation), reuse the existing QString, and use prepend which will typically have allocated extra space, reducing the chances it will reallocate. Change-Id: Ic4ef775246db58e56152a6ede1a75f7621950dd9 Reviewed-by: Marc Mutz --- src/tools/rcc/rcc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 3b5166a70e3..3331ffbb9d2 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -142,7 +142,8 @@ QString RCCFileInfo::resourceName() const QString resource = m_name; for (RCCFileInfo *p = m_parent; p; p = p->m_parent) resource = resource.prepend(p->m_name + u'/'); - return u':' + resource; + resource.prepend(u':'); + return resource; } void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib)