Addresses a couple performance related comments

This commit is contained in:
John Richards
2020-10-20 18:07:39 -04:00
parent 5b819fa23e
commit 50dea39975

View File

@@ -290,6 +290,7 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
stack.pop();
ASTConstMap::values_t values;
values.reserve(operand);
for (int i = 0; i < operand; ++i) {
PycRef<ASTNode> value = stack.top();
stack.pop();
@@ -2452,7 +2453,7 @@ void print_src(PycRef<ASTNode> node, PycModule* mod)
ASTConstMap::values_t values = const_map->values();
auto map = new ASTMap;
for (auto key : keys) {
for (const auto& key : keys) {
// Values are pushed onto the stack in reverse order.
PycRef<ASTNode> value = values.back();
values.pop_back();