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:
Tomas Babej 2021-04-23 22:48:52 -04:00
parent 312f77f703
commit 87b0be9b6f

View file

@ -224,6 +224,8 @@ void Eval::evaluatePostfixStack (
// This is stack used by the postfix evaluator.
std::vector <Variant> values;
values.reserve(tokens.size());
for (const auto& token : tokens)
{
// Unary operators.