Bump up the runtime for "short" benchmarks
authorAnton Youdkevitch <anton.youdkevitch@bell-sw.com>
Fri, 28 Jun 2019 12:38:07 +0000 (13:38 +0100)
committerWilco Dijkstra <wdijkstr@arm.com>
Fri, 28 Jun 2019 12:38:07 +0000 (13:38 +0100)
Some benchmarks with a very short runtime show significantly
different results across runs on Aarch64 - up to tens of percents.
Increasing the runtime to 100ms+ makes the deviation under 5%.

Tested on Aarch64 and x86-64.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* benchtests/bench-memccpy.c: Replace INNER_LOOP_ITERS
with INNER_LOOP_ITERS_LARGE.
* benchtests/bench-memchr.c: Likewise.
* benchtests/bench-rawmemchr.c: Likewise.
* benchtests/bench-strcat.c: Likewise.
* benchtests/bench-strchr.c: Likewise.
* benchtests/bench-string.h: Likewise.
* benchtests/bench-strlen.c: Likewise.
* benchtests/bench-strncpy.c: Likewise.
* benchtests/bench-strnlen.c: Likewise.

ChangeLog
benchtests/bench-memccpy.c
benchtests/bench-memchr.c
benchtests/bench-rawmemchr.c
benchtests/bench-strcat.c
benchtests/bench-strchr.c
benchtests/bench-string.h
benchtests/bench-strlen.c
benchtests/bench-strncpy.c
benchtests/bench-strnlen.c

index 65129ff43a5945ac0a013667ee7bcb00cce23a99..718829d1728d15d6bf0210a61769d42b354f95e4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2019-06-28  Anton Youdkevitch  <anton.youdkevitch@bell-sw.com>
+
+       * benchtests/bench-memccpy.c: Replace INNER_LOOP_ITERS
+       with INNER_LOOP_ITERS_LARGE.
+       * benchtests/bench-memchr.c: Likewise.
+       * benchtests/bench-rawmemchr.c: Likewise.
+       * benchtests/bench-strcat.c: Likewise.
+       * benchtests/bench-strchr.c: Likewise.
+       * benchtests/bench-string.h: Likewise.
+       * benchtests/bench-strlen.c: Likewise.
+       * benchtests/bench-strncpy.c: Likewise.
+       * benchtests/bench-strnlen.c: Likewise.
+
 2019-06-28  Florian Weimer  <fweimer@redhat.com>
 
        * sysdeps/unix/sysv/linux/tst-getdents64.c (large_buffer_checks):
index d3a2df5e72b4ae0bba68c2e94f33d8255d04fcb3..46f96d58c5fe725eec2251b48cd984bb3741d7c0 100644 (file)
@@ -41,7 +41,7 @@ static void
 do_one_test (impl_t *impl, void *dst, const void *src, int c, size_t len,
             size_t n)
 {
-  size_t i, iters = INNER_LOOP_ITERS;
+  size_t i, iters = INNER_LOOP_ITERS_LARGE;
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
index 9bd07eba75f67fa6af8b2304c0c43a2b7f4da2d9..8a9909a984f21d40f9eb4592c5bf83da31cf1f61 100644 (file)
@@ -56,7 +56,7 @@ SIMPLE_MEMCHR (const CHAR *s, int c, size_t n)
 static void
 do_one_test (impl_t *impl, const CHAR *s, int c, size_t n)
 {
-  size_t i, iters = INNER_LOOP_ITERS;
+  size_t i, iters = INNER_LOOP_ITERS_LARGE;
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
index 44f3114fd2338db20e0d503ef08f5032d0de8157..5cdfdf7227c4238c102c5df399c6709540d36756 100644 (file)
@@ -39,7 +39,7 @@ IMPL (generic_rawmemchr, 0)
 static void
 do_one_test (impl_t *impl, const char *s, int c, char *exp_res)
 {
-  size_t i, iters = INNER_LOOP_ITERS;
+  size_t i, iters = INNER_LOOP_ITERS_LARGE;
   timing_t start, stop, cur;
   char *res = CALL (impl, s, c);
   if (res != exp_res)
index 39d9fefb098c194523515e10cc4f47529b3aafd9..08841d037ff42ad30d9e6bb216f6d41dae87467b 100644 (file)
@@ -51,7 +51,7 @@ IMPL (generic_strcat, 0)
 static void
 do_one_test (impl_t *impl, CHAR *dst, const CHAR *src)
 {
-  size_t k = STRLEN (dst), i, iters = INNER_LOOP_ITERS;
+  size_t k = STRLEN (dst), i, iters = INNER_LOOP_ITERS_LARGE;
   timing_t start, stop, cur;
 
   if (CALL (impl, dst, src) != dst)
index b8dba17caed2baac7229f442389be7924db4c44d..10d06feb23bd54e3ffbbf5dbd647e5ff7454acae 100644 (file)
@@ -76,7 +76,7 @@ IMPL (STRCHR, 1)
 static void
 do_one_test (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
 {
-  size_t i, iters = INNER_LOOP_ITERS;
+  size_t i, iters = INNER_LOOP_ITERS_LARGE;
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
index e7fb015bc639d97e702e2c0e3c9aee86c9537e2c..7d357914fd42273fbaab70815551efdfd2b38b63 100644 (file)
@@ -125,6 +125,7 @@ extern impl_t __start_impls[], __stop_impls[];
 # define OPT_SEED 10002
 
 # define INNER_LOOP_ITERS 8192
+# define INNER_LOOP_ITERS_LARGE 131072
 # define INNER_LOOP_ITERS_MEDIUM 1024
 # define INNER_LOOP_ITERS_SMALL 32
 
index 47363af0f749110acdacd87bd8c58a9a676fe43c..1997ad75b4611462fd5e1c3cec7d21c473d6e785 100644 (file)
@@ -48,7 +48,7 @@ IMPL (STRLEN, 1)
 static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, const CHAR *s, size_t exp_len)
 {
-  size_t len = CALL (impl, s), i, iters = INNER_LOOP_ITERS;
+  size_t len = CALL (impl, s), i, iters = INNER_LOOP_ITERS_LARGE;
   timing_t start, stop, cur;
 
   if (len != exp_len)
index 93bd6d54bf79a287f7f1501a2135a25f02e6eeb0..c6a6799a2fae7b80c803d287c8838fd17de5f91d 100644 (file)
@@ -54,7 +54,7 @@ typedef CHAR *(*proto_t) (CHAR *, const CHAR *, size_t);
 static void
 do_one_test (impl_t *impl, CHAR *dst, const CHAR *src, size_t len, size_t n)
 {
-  size_t i, iters = INNER_LOOP_ITERS;
+  size_t i, iters = INNER_LOOP_ITERS_LARGE;
   timing_t start, stop, cur;
 
   if (CALL (impl, dst, src, n) != STRNCPY_RESULT (dst, len, n))
index e9e51b27fc37cb152cc5ef7b3869be1709af2540..72ec30397776a791aa04343727155fdea1f08107 100644 (file)
@@ -51,7 +51,7 @@ IMPL (generic_strnlen, 0)
 static void
 do_one_test (impl_t *impl, const CHAR *s, size_t maxlen, size_t exp_len)
 {
-  size_t len = CALL (impl, s, maxlen), i, iters = INNER_LOOP_ITERS;
+  size_t len = CALL (impl, s, maxlen), i, iters = INNER_LOOP_ITERS_LARGE;
   timing_t start, stop, cur;
 
   if (len != exp_len)