summaryrefslogtreecommitdiffstats
path: root/src/corelib/xml/qxmlstream.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2017-04-13 14:59:57 +0200
committerMarc Mutz <marc.mutz@kdab.com>2017-04-19 12:31:50 +0000
commit58d2927861d3e57cac4f6db599e209d2bfb17a2c (patch)
treea43f5edc122048c28fb5840c917848c753b28953 /src/corelib/xml/qxmlstream.cpp
parente9fd074cecfa5bb79bbaa5522a31aa28e3db43a8 (diff)
QXmlStream: optimize PrivateTagStack::addToStringStorage()
De-duplicate the QString/Ref code paths by using QStringView instead. Keep the old overloads so we can centrally apply the qToStringView- IgnoringNull() optimization. Replace insert(p, ..) where p = size() with append(..). The code ensures in the lines before that the insertion position is the end of the string. Port the few QLatin1String arguments to addToStringStorage() to QStringViewLiteral. I also considered adding a QLatin1String() overload, but the test size increased, so the function wasn't pulling its own weight. This version saves 360B in text size on optimized GCC 6.1 Linux AMD64 builds. Change-Id: I4b759fddc38b1f97a7218954e756cc19400922e9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/xml/qxmlstream.cpp')
-rw-r--r--src/corelib/xml/qxmlstream.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index 3d600c2380..195466e803 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -775,8 +775,8 @@ QXmlStreamPrivateTagStack::QXmlStreamPrivateTagStack()
tagStackStringStorage.reserve(32);
tagStackStringStorageSize = 0;
NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push();
- namespaceDeclaration.prefix = addToStringStorage(QLatin1String("xml"));
- namespaceDeclaration.namespaceUri = addToStringStorage(QLatin1String("http://www.w3.org/XML/1998/namespace"));
+ namespaceDeclaration.prefix = addToStringStorage(QStringViewLiteral("xml"));
+ namespaceDeclaration.namespaceUri = addToStringStorage(QStringViewLiteral("http://www.w3.org/XML/1998/namespace"));
initialTagStackStringStorageSize = tagStackStringStorageSize;
}