Shell: Add iteration_times.ensure_capacity() in builtin_time

This commit is contained in:
Musab Kılıç 2021-08-27 19:56:09 +03:00 committed by Andreas Kling
parent 75a706b6eb
commit 29a9be6503
Notes: sideshowbarker 2024-07-18 05:12:20 +09:00

View file

@ -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) {
@ -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) {