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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user