1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:07:35 +00:00

Shell: Avoid a needless loop in builtin_time()

Not performance sensitive, but perhaps a bit neater? :^)
This commit is contained in:
Valtteri Koskivuori 2021-08-23 22:26:31 +03:00 committed by Andreas Kling
parent ad427f85ca
commit b28b4c643e

View file

@ -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:");