Skip to content

Commit

Permalink
Shell: Add iteration_times.ensure_capacity() in builtin_time
Browse files Browse the repository at this point in the history
  • Loading branch information
musabkilic authored and awesomekling committed Aug 27, 2021
1 parent 75a706b commit 29a9be6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Userland/Shell/Builtin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,7 @@ int Shell::builtin_time(int argc, const char** argv)
auto commands = expand_aliases({ move(command) });

Vector<int> iteration_times;
iteration_times.ensure_capacity(number_of_iterations);

int exit_code = 1;
for (int i = 0; i < number_of_iterations; ++i) {
Expand All @@ -936,7 +937,7 @@ int Shell::builtin_time(int argc, const char** argv)
block_on_job(job);
exit_code = job.exit_code();
}
iteration_times.append(timer.elapsed());
iteration_times.unchecked_append(timer.elapsed());
}

if (number_of_iterations == 1) {
Expand Down

0 comments on commit 29a9be6

Please sign in to comment.