mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
performance: Pre-emptively reserve size of the values vector
Each token will add a corresponding Variant into the vector, so we can avoid the performance penalty connected with dynamic resizes of the vector.
This commit is contained in:
parent
312f77f703
commit
87b0be9b6f
1 changed files with 2 additions and 0 deletions
|
@ -224,6 +224,8 @@ void Eval::evaluatePostfixStack (
|
||||||
|
|
||||||
// This is stack used by the postfix evaluator.
|
// This is stack used by the postfix evaluator.
|
||||||
std::vector <Variant> values;
|
std::vector <Variant> values;
|
||||||
|
values.reserve(tokens.size());
|
||||||
|
|
||||||
for (const auto& token : tokens)
|
for (const auto& token : tokens)
|
||||||
{
|
{
|
||||||
// Unary operators.
|
// Unary operators.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue