public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org, Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Subject: Re: [PATCH] Benchtests: Adjust timing
Date: Fri, 24 Mar 2023 10:51:34 -0300	[thread overview]
Message-ID: <db4b8c62-9126-ff64-d0b4-9b9d569b5c0b@linaro.org> (raw)
In-Reply-To: <PAWPR08MB898266EED052CB41D57B5FA683879@PAWPR08MB8982.eurprd08.prod.outlook.com>



On 23/03/23 08:44, Wilco Dijkstra via Libc-alpha wrote:
> 
> Adjust iteration counts so benchmarks don't run too slowly or quickly.
> Ensure benchmarks take less than 10 seconds on older, slower cores and
> more than 0.5 seconds on fast cores.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> 
> ---
> 
> diff --git a/benchtests/bench-bzero.c b/benchtests/bench-bzero.c
> index 7ff04f2d2fcea7d32c45ef4cf032032031773065..5e891ce87549d017587df4fc2a4cdaba788b4093 100644
> --- a/benchtests/bench-bzero.c
> +++ b/benchtests/bench-bzero.c
> @@ -51,7 +51,7 @@ IMPL (memset_zero, 0)
>  static void
>  do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n)
>  {
> -  size_t i, iters = INNER_LOOP_ITERS_LARGE;
> +  size_t i, iters = INNER_LOOP_ITERS8;
>    timing_t start, stop, cur;
>  
>    TIMING_NOW (start);
> diff --git a/benchtests/bench-hash-funcs.c b/benchtests/bench-hash-funcs.c
> index 5e7e5022307cf58058f76b64ab3fb4ee84462438..4a6858c0217bc3932da665ae9c74427beb7b8836 100644
> --- a/benchtests/bench-hash-funcs.c
> +++ b/benchtests/bench-hash-funcs.c
> @@ -42,7 +42,7 @@ enum
>  {
>    NFIXED_ITERS = 1048576,
>    NRAND_BUFS = 16384,
> -  NRAND_ITERS = 2048,
> +  NRAND_ITERS = 256,
>    RAND_BENCH_MAX_LEN = 128
>  };
>  
> diff --git a/benchtests/bench-memccpy.c b/benchtests/bench-memccpy.c
> index 51ed8dad2f5033fc337a7b7422272c48480b2e93..a26ed7eee2374d12d6bef5e721f941d9c5ddcc6a 100644
> --- a/benchtests/bench-memccpy.c
> +++ b/benchtests/bench-memccpy.c
> @@ -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_LARGE;
> +  size_t i, iters = INNER_LOOP_ITERS_LARGE * 4;
>    timing_t start, stop, cur;
>  
>    TIMING_NOW (start);
> diff --git a/benchtests/bench-memchr.c b/benchtests/bench-memchr.c
> index 90bd3879e32e81950c633cf7f2d4f3f6a92d2311..1a9bf511188f8ec511b10e92632b5ed1dbd3e445 100644
> --- a/benchtests/bench-memchr.c
> +++ b/benchtests/bench-memchr.c
> @@ -51,7 +51,7 @@ static void
>  do_one_test (json_ctx_t *json_ctx, impl_t *impl, const CHAR *s, int c,
>  	     size_t n)
>  {
> -  size_t i, iters = INNER_LOOP_ITERS;
> +  size_t i, iters = INNER_LOOP_ITERS8 / 2;
>    timing_t start, stop, cur;
>  
>    TIMING_NOW (start);
> diff --git a/benchtests/bench-memcpy-random.c b/benchtests/bench-memcpy-random.c
> index a0753b60e02c677f50de1220c785f4f7214d6bb0..48cb64d533c5e5867226552ee5d9a84da256ef2f 100644
> --- a/benchtests/bench-memcpy-random.c
> +++ b/benchtests/bench-memcpy-random.c
> @@ -127,7 +127,7 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src,
>  	     copy_t *copy, size_t n)
>  {
>    timing_t start, stop, cur;
> -  size_t iters = INNER_LOOP_ITERS_MEDIUM;
> +  size_t iters = INNER_LOOP_ITERS_MEDIUM / 2;
>  
>    for (int j = 0; j < n; j++)
>      CALL (impl, dst + copy[j].dst, src + copy[j].src, copy[j].len);
> diff --git a/benchtests/bench-memcpy.c b/benchtests/bench-memcpy.c
> index 1fd41c035fe4fae74d576f38db78ad2eadb8748a..5be09966e0eace1aed1d4625df5f24f4cbc07214 100644
> --- a/benchtests/bench-memcpy.c
> +++ b/benchtests/bench-memcpy.c
> @@ -38,7 +38,7 @@ static void
>  do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, const char *src,
>  	     size_t len)
>  {
> -  size_t i, iters = INNER_LOOP_ITERS;
> +  size_t i, iters = INNER_LOOP_ITERS / 2;
>    timing_t start, stop, cur;
>    for (i = 0; i < iters / 64; ++i)
>      {
> diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c
> index 1e785e6c8f6411aa34d205a219abd8b5d29a7f4e..e68b14201e097678847a9fba2bad76fb20970491 100644
> --- a/benchtests/bench-memset.c
> +++ b/benchtests/bench-memset.c
> @@ -43,7 +43,7 @@ static void
>  do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s,
>  	     int c __attribute ((unused)), size_t n)
>  {
> -  size_t i, iters = INNER_LOOP_ITERS_LARGE;
> +  size_t i, iters = INNER_LOOP_ITERS;
>    timing_t start, stop, cur;
>  
>    TIMING_NOW (start);
> diff --git a/benchtests/bench-strcat.c b/benchtests/bench-strcat.c
> index 96383ce06a5aa88d0ca1bbd20b3b2826e40f14f2..08a19e53c9fc4208c59f5d2bade64594e2005bcd 100644
> --- a/benchtests/bench-strcat.c
> +++ b/benchtests/bench-strcat.c
> @@ -52,7 +52,7 @@ IMPL (generic_strcat, 0)
>  static void
>  do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *dst, const CHAR *src)
>  {
> -  size_t k = STRLEN (dst), i, iters = INNER_LOOP_ITERS_LARGE;
> +  size_t k = STRLEN (dst), i, iters = INNER_LOOP_ITERS_LARGE / CHARBYTES;
>    timing_t start, stop, cur;
>  
>    if (CALL (impl, dst, src) != dst)
> diff --git a/benchtests/bench-strcmp.c b/benchtests/bench-strcmp.c
> index 65fd04b43a2aeaab85ee4996f083333a32d7b29f..f696f074fcc7d56e967eabbf3b5c48600e8fc0f5 100644
> --- a/benchtests/bench-strcmp.c
> +++ b/benchtests/bench-strcmp.c
> @@ -50,7 +50,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 / 2;
>    timing_t start, stop, cur;
>  
>    TIMING_NOW (start);
> diff --git a/benchtests/bench-strlen.c b/benchtests/bench-strlen.c
> index 9b91f8a10ef0621cf2bc8310d8f08bd978b6d898..cae88dd6ec1794709fdf36a373896dd2d9d285dd 100644
> --- a/benchtests/bench-strlen.c
> +++ b/benchtests/bench-strlen.c
> @@ -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_ITERS8;
> +  size_t len = CALL (impl, s), i, iters = INNER_LOOP_ITERS_LARGE;
>    timing_t start, stop, cur;
>  
>    if (len != exp_len)
> diff --git a/benchtests/bench-strncpy.c b/benchtests/bench-strncpy.c
> index 83a88f658318f16a13c476a3a0bd685ee0e4d889..d90e3c55e28c1ce88ae660a74972bc4374c142f2 100644
> --- a/benchtests/bench-strncpy.c
> +++ b/benchtests/bench-strncpy.c
> @@ -57,7 +57,7 @@ static void
>  do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *dst, const CHAR *src,
>  	     size_t len, size_t n)
>  {
> -  size_t i, iters = INNER_LOOP_ITERS_LARGE * (4 / CHARBYTES);
> +  size_t i, iters = INNER_LOOP_ITERS_LARGE / CHARBYTES;
>    timing_t start, stop, cur;
>  
>    if (CALL (impl, dst, src, n) != STRNCPY_RESULT (dst, len, n))
> 
> 

      reply	other threads:[~2023-03-24 13:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23 11:44 Wilco Dijkstra
2023-03-24 13:51 ` Adhemerval Zanella Netto [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=db4b8c62-9126-ff64-d0b4-9b9d569b5c0b@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).