diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-05-02 10:57:44 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-05-05 17:32:31 +0000 |
commit | 6706cb46eb463357cffe7c57988a768156b2ae79 (patch) | |
tree | 18fb998f8b8ad7d0c883500841f75f7f2175e73b /src/plugins | |
parent | dd0ab5b2f125b6769c8522d4468c62b20f5cd0bb (diff) |
GLTFIO: remove {QMap,QMultiHash}::remove() calls
They are preceded by operator[] calls with the same argument,
causing the node to be looked up twice each time (once in
op[] and then again in remove()).
Just call find() and use erase(it) to remove the node later.
Costs ~32B in text size. Reason unknown.
Change-Id: I1bef16a6871ff7922c6b3fc5e1449defbaa582b4
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/sceneparsers/gltf/gltfio.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/sceneparsers/gltf/gltfio.cpp b/src/plugins/sceneparsers/gltf/gltfio.cpp index 01c4596b4..939404fcd 100644 --- a/src/plugins/sceneparsers/gltf/gltfio.cpp +++ b/src/plugins/sceneparsers/gltf/gltfio.cpp @@ -993,11 +993,12 @@ void GLTFIO::processJSONTechnique(const QString &id, const QJsonObject &jsonObje continue; } //Check if the parameter has a standard attribute semantic - QString standardAttributeName = standardAttributeNameFromSemantic(m_parameterDataDict[parameter].semantic); + const auto paramDataIt = m_parameterDataDict.find(parameter); + QString standardAttributeName = standardAttributeNameFromSemantic(paramDataIt->semantic); if (!standardAttributeName.isNull()) { attributeName = standardAttributeName; t->removeParameter(parameter); - m_parameterDataDict.remove(parameter); + m_parameterDataDict.erase(paramDataIt); delete parameter; } @@ -1014,9 +1015,10 @@ void GLTFIO::processJSONTechnique(const QString &id, const QJsonObject &jsonObje continue; } //Check if the parameter has a standard uniform semantic - if (hasStandardUniformNameFromSemantic(m_parameterDataDict[parameter].semantic)) { + const auto paramDataIt = m_parameterDataDict.find(parameter); + if (hasStandardUniformNameFromSemantic(paramDataIt->semantic)) { t->removeParameter(parameter); - m_parameterDataDict.remove(parameter); + m_parameterDataDict.erase(paramDataIt); delete parameter; } } // of program-instance uniforms |