diff options
author | Valtteri Koskivuori <vkoskiv@gmail.com> | 2021-08-23 22:26:31 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-23 22:44:32 +0200 |
commit | b28b4c643e2742551e6fbe7922ca1e520869f698 (patch) | |
tree | 6b1045a20f36b1d47900bc39bc90f38a568a3757 /Userland/Shell | |
parent | ad427f85ca3f1dac782bc8fb3106d14f22326121 (diff) | |
download | serenity-b28b4c643e2742551e6fbe7922ca1e520869f698.zip |
Shell: Avoid a needless loop in builtin_time()
Not performance sensitive, but perhaps a bit neater? :^)
Diffstat (limited to 'Userland/Shell')
-rw-r--r-- | Userland/Shell/Builtin.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
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<float>(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<float>(iteration_times[i]); + float total_time_excluding_first = total_time - static_cast<float>(iteration_times.first()); float average_excluding_first = total_time_excluding_first / (iteration_times.size() - 1); warnln("Timing report:"); |