diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-10-13 11:44:47 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-10-18 15:51:33 +0200 |
commit | 4a012ce83678b01663c9dc7d9423dff7d846ce23 (patch) | |
tree | 72a84fb834310510188dce8ed7465db178f77b54 /src/qml/compiler/qv4bytecodegenerator.cpp | |
parent | 785addcd17c7988be90a2ca17599c12b07e4e170 (diff) | |
download | qtdeclarative-4a012ce83678b01663c9dc7d9423dff7d846ce23.tar.gz |
Reserve space in std::vector before appending
This is often faster than resizing on demand.
Task-number: QTBUG-89513
Change-Id: Ie125df2bfc25db73fc3d92040b21a526a3a65f4b
Reviewed-by: Nick Shaforostov <mshaforostov@airmusictech.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4bytecodegenerator.cpp')
-rw-r--r-- | src/qml/compiler/qv4bytecodegenerator.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4bytecodegenerator.cpp b/src/qml/compiler/qv4bytecodegenerator.cpp index ea7469cd67..2e81fd5eed 100644 --- a/src/qml/compiler/qv4bytecodegenerator.cpp +++ b/src/qml/compiler/qv4bytecodegenerator.cpp @@ -188,9 +188,9 @@ void BytecodeGenerator::finalize(Compiler::Context *context) context->lineNumberMapping = lineNumbers; context->sourceLocationTable = std::move(m_sourceLocationTable); - for (const auto &li : _labelInfos) { + context->labelInfo.reserve(context->labelInfo.size() + _labelInfos.size()); + for (const auto &li : _labelInfos) context->labelInfo.push_back(instructions.at(labels.at(li.labelIndex)).position); - } } int BytecodeGenerator::addInstructionHelper(Instr::Type type, const Instr &i, int offsetOfOffset) { |