summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2017-02-06 21:46:11 +0100
committerMarc Mutz <marc.mutz@kdab.com>2017-02-07 09:50:00 +0000
commit140122533085c62dd7f2e59ddc6bf2933db19c93 (patch)
tree5edccb7b761acf8f27fab5c5912dd2d8d4f21c97 /src/corelib/io
parent3de596a321438e7c7a6e52bca365574d87de2649 (diff)
QLoggingRegistry: optimize updateRules()
... by not creating three temporary QVectors just to concatenate them. There's no QVectorBuilder, so what works well with QStrings doesn't work well at all with QVectors. The chaining of op+ causes three temporary QVectors to be created and thrown away. Instead, use clear() (which preserves the vector's capacity these days), followed by four op+=. Change-Id: I300bd35544ea41037d28db0f48f210c33c826b85 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qloggingregistry.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp
index eaebbc1ffc..b8d1919ee6 100644
--- a/src/corelib/io/qloggingregistry.cpp
+++ b/src/corelib/io/qloggingregistry.cpp
@@ -365,7 +365,12 @@ void QLoggingRegistry::setApiRules(const QString &content)
*/
void QLoggingRegistry::updateRules()
{
- rules = qtConfigRules + configRules + apiRules + envRules;
+ rules.clear();
+ rules.reserve(qtConfigRules.size() + configRules.size() + apiRules.size() + envRules.size()),
+ rules += qtConfigRules;
+ rules += configRules;
+ rules += apiRules;
+ rules += envRules;
for (auto it = categories.keyBegin(), end = categories.keyEnd(); it != end; ++it)
(*categoryFilter)(*it);