Commit 8001ad74 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Add vector::reserve() calls everywhere we had StlCompatAllocators

parent 8618e750
......@@ -821,6 +821,7 @@ Box* ASTInterpreter::doOSR(AST_Jump* node) {
OSRExit exit(found_entry);
std::vector<Box*> arg_array;
arg_array.reserve(sorted_symbol_table.size());
for (auto& it : sorted_symbol_table) {
arg_array.push_back(it.second);
}
......@@ -1089,10 +1090,14 @@ Value ASTInterpreter::createFunction(AST* node, AST_arguments* args, const std::
std::vector<Box*> defaults;
llvm::SmallVector<RewriterVar*, 4> defaults_vars;
defaults.reserve(args->defaults.size());
RewriterVar* defaults_var = NULL;
if (jit)
if (jit) {
defaults_var = args->defaults.size() ? jit->allocate(args->defaults.size()) : jit->imm(0ul);
defaults_vars.reserve(args->defaults.size());
}
int i = 0;
for (AST_expr* d : args->defaults) {
Value v = visit_expr(d);
......@@ -1180,6 +1185,7 @@ Value ASTInterpreter::visit_makeFunction(AST_MakeFunction* mkfn) {
AST_arguments* args = node->args;
std::vector<Value> decorators;
decorators.reserve(node->decorator_list.size());
for (AST_expr* d : node->decorator_list)
decorators.push_back(visit_expr(d));
......@@ -1210,6 +1216,7 @@ Value ASTInterpreter::visit_makeClass(AST_MakeClass* mkclass) {
}
std::vector<Box*> decorators;
decorators.reserve(node->decorator_list.size());
for (AST_expr* d : node->decorator_list)
decorators.push_back(visit_expr(d).o);
......@@ -1485,6 +1492,9 @@ Value ASTInterpreter::visit_call(AST_Call* node) {
std::vector<Box*> args;
llvm::SmallVector<RewriterVar*, 8> args_vars;
args.reserve(node->args.size());
args_vars.reserve(node->args.size());
for (AST_expr* e : node->args) {
Value v = visit_expr(e);
args.push_back(v.o);
......
......@@ -803,10 +803,14 @@ Box* map(Box* f, BoxedTuple* args) {
if (num_iterable == 1)
return map2(f, args->elts[0]);
std::deque<BoxIteratorRange> ranges;
std::vector<BoxIteratorRange> ranges;
std::vector<BoxIterator> args_it;
std::vector<BoxIterator> args_end;
ranges.reserve(args->size());
args_it.reserve(args->size());
args_end.reserve(args->size());
for (auto e : *args) {
auto range = e->pyElements();
ranges.push_back(std::move(range));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment