diff options
author | Wilco Dijkstra <wdijkstr@arm.com> | 2019-06-28 13:42:36 +0100 |
---|---|---|
committer | Wilco Dijkstra <wdijkstr@arm.com> | 2019-06-28 13:42:36 +0100 |
commit | d064591266634a8ff55b645181167b8626c793c9 (patch) | |
tree | 8a4ed4f134ff22e278704b6722f726f7705cd2ad | |
parent | afe23eb0f1942cb033ffdf3a338f669be4683f6c (diff) | |
download | glibc-d064591266634a8ff55b645181167b8626c793c9.tar.gz glibc-d064591266634a8ff55b645181167b8626c793c9.tar.xz glibc-d064591266634a8ff55b645181167b8626c793c9.zip |
Further improve string bench timing
Further improve the timings of the string benchmarks. Ensure most take between 1 and 4 seconds to improve accuracy. Overall time taken increases by 35%. Tested on AArch64. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> * benchtests/bench-math-inlines.c: Increase iterations. * benchtests/bench-memcmp.c: Likewise. * benchtests/bench-rawmemchr.c: Likewise. * benchtests/bench-strcmp.c: Likewise. * benchtests/bench-strcpy_chk.c: Likewise. * benchtests/bench-string.h (INNER_LOOP_ITERS8): Add define. (INNER_LOOP_ITERS_MEDIUM): Increase iterations. (INNER_LOOP_ITERS_SMALL): Likewise. * benchtests/bench-strncat.c: Increase iterations. * benchtests/bench-strncmp.c: Increase iterations. * benchtests/bench-strncpy.c: Reduce iterations for wide strings. * benchtests/bench-strrchr.c: Increase iterations. * benchtests/bench-strstr.c: Keep iterations unchanged. * benchtests/bench-strtod.c: Increase iterations.
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | benchtests/bench-math-inlines.c | 2 | ||||
-rw-r--r-- | benchtests/bench-memcmp.c | 2 | ||||
-rw-r--r-- | benchtests/bench-rawmemchr.c | 2 | ||||
-rw-r--r-- | benchtests/bench-strcmp.c | 2 | ||||
-rw-r--r-- | benchtests/bench-strcpy_chk.c | 2 | ||||
-rw-r--r-- | benchtests/bench-string.h | 5 | ||||
-rw-r--r-- | benchtests/bench-strncat.c | 2 | ||||
-rw-r--r-- | benchtests/bench-strncmp.c | 2 | ||||
-rw-r--r-- | benchtests/bench-strncpy.c | 2 | ||||
-rw-r--r-- | benchtests/bench-strrchr.c | 2 | ||||
-rw-r--r-- | benchtests/bench-strstr.c | 2 | ||||
-rw-r--r-- | benchtests/bench-strtod.c | 2 |
13 files changed, 31 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog index 718829d172..aece032385 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2019-06-28 Wilco Dijkstra <wdijkstr@arm.com> + + * benchtests/bench-math-inlines.c: Increase iterations. + * benchtests/bench-memcmp.c: Likewise. + * benchtests/bench-rawmemchr.c: Likewise. + * benchtests/bench-strcmp.c: Likewise. + * benchtests/bench-strcpy_chk.c: Likewise. + * benchtests/bench-string.h (INNER_LOOP_ITERS8): Add define. + (INNER_LOOP_ITERS_MEDIUM): Increase iterations. + (INNER_LOOP_ITERS_SMALL): Likewise. + * benchtests/bench-strncat.c: Increase iterations. + * benchtests/bench-strncmp.c: Increase iterations. + * benchtests/bench-strncpy.c: Reduce iterations for wide strings. + * benchtests/bench-strrchr.c: Increase iterations. + * benchtests/bench-strstr.c: Keep iterations unchanged. + * benchtests/bench-strtod.c: Increase iterations. + 2019-06-28 Anton Youdkevitch <anton.youdkevitch@bell-sw.com> * benchtests/bench-memccpy.c: Replace INNER_LOOP_ITERS diff --git a/benchtests/bench-math-inlines.c b/benchtests/bench-math-inlines.c index aed85ca988..37331bc662 100644 --- a/benchtests/bench-math-inlines.c +++ b/benchtests/bench-math-inlines.c @@ -220,7 +220,7 @@ static void do_one_test (json_ctx_t *json_ctx, proto_t test_fn, volatile double *arr, size_t len, const char *testname) { - size_t iters = 500; + size_t iters = 2048; timing_t start, stop, cur; json_attr_object_begin (json_ctx, testname); diff --git a/benchtests/bench-memcmp.c b/benchtests/bench-memcmp.c index 4f01e3100d..a6af107855 100644 --- a/benchtests/bench-memcmp.c +++ b/benchtests/bench-memcmp.c @@ -63,7 +63,7 @@ static void do_one_test (json_ctx_t *json_ctx, impl_t *impl, const CHAR *s1, const CHAR *s2, size_t len, int exp_result) { - size_t i, iters = INNER_LOOP_ITERS; + size_t i, iters = INNER_LOOP_ITERS8; timing_t start, stop, cur; TIMING_NOW (start); diff --git a/benchtests/bench-rawmemchr.c b/benchtests/bench-rawmemchr.c index 5cdfdf7227..f7e1524d8a 100644 --- a/benchtests/bench-rawmemchr.c +++ b/benchtests/bench-rawmemchr.c @@ -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_LARGE; + size_t i, iters = INNER_LOOP_ITERS_LARGE * 4; timing_t start, stop, cur; char *res = CALL (impl, s, c); if (res != exp_res) diff --git a/benchtests/bench-strcmp.c b/benchtests/bench-strcmp.c index c87b3ac02b..b8d355c3ce 100644 --- a/benchtests/bench-strcmp.c +++ b/benchtests/bench-strcmp.c @@ -83,7 +83,7 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, const CHAR *s1, const CHAR *s2, int exp_result) { - size_t i, iters = INNER_LOOP_ITERS; + size_t i, iters = INNER_LOOP_ITERS8; timing_t start, stop, cur; TIMING_NOW (start); diff --git a/benchtests/bench-strcpy_chk.c b/benchtests/bench-strcpy_chk.c index 3030763100..34c9c78a77 100644 --- a/benchtests/bench-strcpy_chk.c +++ b/benchtests/bench-strcpy_chk.c @@ -77,7 +77,7 @@ do_one_test (impl_t *impl, char *dst, const char *src, size_t len, size_t dlen) { char *res; - size_t i, iters = INNER_LOOP_ITERS; + size_t i, iters = INNER_LOOP_ITERS8; timing_t start, stop, cur; if (dlen <= len) diff --git a/benchtests/bench-string.h b/benchtests/bench-string.h index 7d357914fd..4831e21054 100644 --- a/benchtests/bench-string.h +++ b/benchtests/bench-string.h @@ -125,9 +125,10 @@ extern impl_t __start_impls[], __stop_impls[]; # define OPT_SEED 10002 # define INNER_LOOP_ITERS 8192 +# define INNER_LOOP_ITERS8 32768 # define INNER_LOOP_ITERS_LARGE 131072 -# define INNER_LOOP_ITERS_MEDIUM 1024 -# define INNER_LOOP_ITERS_SMALL 32 +# define INNER_LOOP_ITERS_MEDIUM 2048 +# define INNER_LOOP_ITERS_SMALL 256 int ret, do_srandom; unsigned int seed; diff --git a/benchtests/bench-strncat.c b/benchtests/bench-strncat.c index 7271626d50..e7583dfad4 100644 --- a/benchtests/bench-strncat.c +++ b/benchtests/bench-strncat.c @@ -51,7 +51,7 @@ IMPL (generic_strncat, 0) static void do_one_test (impl_t *impl, CHAR *dst, const CHAR *src, size_t n) { - size_t k = STRLEN (dst), i, iters = INNER_LOOP_ITERS; + size_t k = STRLEN (dst), i, iters = INNER_LOOP_ITERS8; timing_t start, stop, cur; if (CALL (impl, dst, src, n) != dst) diff --git a/benchtests/bench-strncmp.c b/benchtests/bench-strncmp.c index a4f3412a8f..bd3f9b2871 100644 --- a/benchtests/bench-strncmp.c +++ b/benchtests/bench-strncmp.c @@ -73,7 +73,7 @@ static void do_one_test (json_ctx_t *json_ctx, impl_t *impl, const CHAR *s1, const CHAR *s2, size_t n, int exp_result) { - size_t i, iters = INNER_LOOP_ITERS; + size_t i, iters = INNER_LOOP_ITERS8; timing_t start, stop, cur; TIMING_NOW (start); diff --git a/benchtests/bench-strncpy.c b/benchtests/bench-strncpy.c index c6a6799a2f..a26232f423 100644 --- a/benchtests/bench-strncpy.c +++ b/benchtests/bench-strncpy.c @@ -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_LARGE; + size_t i, iters = INNER_LOOP_ITERS_LARGE * (4 / CHARBYTES); timing_t start, stop, cur; if (CALL (impl, dst, src, n) != STRNCPY_RESULT (dst, len, n)) diff --git a/benchtests/bench-strrchr.c b/benchtests/bench-strrchr.c index faf64265d2..bdb3b41d40 100644 --- a/benchtests/bench-strrchr.c +++ b/benchtests/bench-strrchr.c @@ -56,7 +56,7 @@ static void do_one_test (impl_t *impl, const CHAR *s, int c, CHAR *exp_res) { CHAR *res = CALL (impl, s, c); - size_t i, iters = INNER_LOOP_ITERS; + size_t i, iters = INNER_LOOP_ITERS8; timing_t start, stop, cur; if (res != exp_res) diff --git a/benchtests/bench-strstr.c b/benchtests/bench-strstr.c index 89d1755813..36b7669d59 100644 --- a/benchtests/bench-strstr.c +++ b/benchtests/bench-strstr.c @@ -131,7 +131,7 @@ IMPL (basic_strstr, 0) static void do_one_test (impl_t *impl, const char *s1, const char *s2, char *exp_result) { - size_t i, iters = INNER_LOOP_ITERS_SMALL; + size_t i, iters = INNER_LOOP_ITERS_SMALL / 8; timing_t start, stop, cur; char *res; diff --git a/benchtests/bench-strtod.c b/benchtests/bench-strtod.c index d5b2503553..780c04ab0a 100644 --- a/benchtests/bench-strtod.c +++ b/benchtests/bench-strtod.c @@ -24,7 +24,7 @@ #include "bench-timing.h" #undef INNER_LOOP_ITERS -#define INNER_LOOP_ITERS 65536 +#define INNER_LOOP_ITERS 131072 static const char *inputs[] = { |