From: Loup Vaillant Date: Wed, 20 Sep 2017 22:32:59 +0000 (+0200) Subject: Corrected timing computation for the speed benchmark X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=2dbf1026b9fd0029cc7c647c1d8b4bc934cb55c5;p=Monocypher.git Corrected timing computation for the speed benchmark I intended to take the best timing out of several tries. Turned out I only took the *last* timing, which defeats the purpose. Now we take the fastest try as intended. The results are now a bit more stable. --- diff --git a/tests/speed.c b/tests/speed.c index 3ce663b..64fac0f 100644 --- a/tests/speed.c +++ b/tests/speed.c @@ -53,6 +53,8 @@ static void print(const char *name, u64 speed, const char *unit) #define TIMING_START \ timespec duration; \ + duration.tv_sec = -1; \ + duration.tv_nsec = -1; \ duration.tv_sec = 3600 * 24; \ duration.tv_nsec = 0; \ FOR (i, 0, 50) { \ @@ -60,7 +62,7 @@ static void print(const char *name, u64 speed, const char *unit) #define TIMING_END \ TIMESTAMP(end); \ - duration = diff(start, end); \ + duration = min(duration, diff(start, end)); \ } /* end FOR*/ \ return speed(duration)