I am trying to check how many different images exits in a folder that contains images that can be the same but with different names. For that, I am using their md5 sums to see if two images are the same.
I do not know if there is a faster way for achieving the same results, but I am more interested in understanding why exits a really difference in performance if I execute the same code several times in a row.
I read this really good post of time command but did not find any conclusion.
$ time md5 -q * | sort | uniq | wc -l
1184
real 1m7.923s
user 0m1.408s
sys 0m0.796s
$ time md5 -q * | sort | uniq | wc -l
1184
real 0m11.220s
user 0m1.345s
sys 0m0.686s
$ time md5 -q * | sort | uniq | wc -l
1184
real 0m9.011s
user 0m1.321s
sys 0m0.595s
$ time md5 -q * | sort | uniq | wc -l
1184
real 0m1.644s
user 0m1.257s
sys 0m0.386s
$ time md5 -q * | sort | uniq | wc -l
1184
real 0m2.213s
user 0m1.267s
sys 0m0.408s
$ time md5 -q * | sort | uniq | wc -l
1184
real 0m1.541s
user 0m1.253s
sys 0m0.380s
$ time md5 -q * | sort -u | wc -l
1184
real 0m1.551s
user 0m1.253s
sys 0m0.387s
$ time md5 -q * | sort -u | wc -l
1184
real 0m1.553s
user 0m1.255s
sys 0m0.388s
# Here I waited for 5 minutes.
$ time md5 -q * | sort -u | wc -l
1184
real 0m12.028s
user 0m1.352s
sys 0m0.720s
Is the real time variability due to execution priority? Should I just consider user time? Well, waiting one minute (real time) for a task that can be completed in just one second is really annoying...
FYI: I am executing the previous code in a MacOS High Sierra computer.