mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-08 14:20:07 +00:00
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.
This commit is contained in:
parent
afe23eb0f1
commit
d064591266
17
ChangeLog
17
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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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))
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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[] =
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user