From b28b4c643e2742551e6fbe7922ca1e520869f698 Mon Sep 17 00:00:00 2001 From: Valtteri Koskivuori Date: Mon, 23 Aug 2021 22:26:31 +0300 Subject: Shell: Avoid a needless loop in builtin_time() Not performance sensitive, but perhaps a bit neater? :^) --- Userland/Shell/Builtin.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Userland/Shell') diff --git a/Userland/Shell/Builtin.cpp b/Userland/Shell/Builtin.cpp index d0e7417769..b59cff5051 100644 --- a/Userland/Shell/Builtin.cpp +++ b/Userland/Shell/Builtin.cpp @@ -946,9 +946,7 @@ int Shell::builtin_time(int argc, const char** argv) total_time += static_cast(time); float average = total_time / iteration_times.size(); - float total_time_excluding_first = 0; - for (size_t i = 1; i < iteration_times.size(); ++i) - total_time_excluding_first += static_cast(iteration_times[i]); + float total_time_excluding_first = total_time - static_cast(iteration_times.first()); float average_excluding_first = total_time_excluding_first / (iteration_times.size() - 1); warnln("Timing report:"); -- cgit v1.2.3