* [PATCH] Benchtests: Remove memchr_strnlen
@ 2023-03-08 10:50 Wilco Dijkstra
2023-03-08 15:18 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 2+ messages in thread
From: Wilco Dijkstra @ 2023-03-08 10:50 UTC (permalink / raw)
To: 'GNU C Library'
Remove memchr_strnlen since it is now the same as generic_strnlen. Adjust iteration
count to reduce benchmark time.
(I kept memchr_strlen since the generic strlen does not use memchr).
---
diff --git a/benchtests/bench-strlen.c b/benchtests/bench-strlen.c
index cae88dd6ec1794709fdf36a373896dd2d9d285dd..9b91f8a10ef0621cf2bc8310d8f08bd978b6d898 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_ITERS_LARGE;
+ size_t len = CALL (impl, s), i, iters = INNER_LOOP_ITERS8;
timing_t start, stop, cur;
if (len != exp_len)
diff --git a/benchtests/bench-strnlen.c b/benchtests/bench-strnlen.c
index c997d7da4c93b08070b718ef22cbd5582feeca09..a1840afa85c52dfecd35b1e4bb36d339b0866483 100644
--- a/benchtests/bench-strnlen.c
+++ b/benchtests/bench-strnlen.c
@@ -22,7 +22,6 @@
#else
# define TEST_NAME "wcsnlen"
# define generic_strnlen generic_wcsnlen
-# define memchr_strnlen wcschr_wcsnlen
#endif /* WIDE */
#include "bench-string.h"
#include "json-lib.h"
@@ -38,22 +37,14 @@
typedef size_t (*proto_t) (const CHAR *, size_t);
size_t generic_strnlen (const CHAR *, size_t);
-size_t
-memchr_strnlen (const CHAR *s, size_t maxlen)
-{
- const CHAR *s1 = MEMCHR (s, 0, maxlen);
- return (s1 == NULL) ? maxlen : s1 - s;
-}
-
IMPL (STRNLEN, 1)
-IMPL (memchr_strnlen, 0)
IMPL (generic_strnlen, 0)
static void
do_one_test (json_ctx_t *json_ctx, 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_LARGE;
+ size_t len = CALL (impl, s, maxlen), i, iters = INNER_LOOP_ITERS;
timing_t start, stop, cur;
if (len != exp_len)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Benchtests: Remove memchr_strnlen
2023-03-08 10:50 [PATCH] Benchtests: Remove memchr_strnlen Wilco Dijkstra
@ 2023-03-08 15:18 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella Netto @ 2023-03-08 15:18 UTC (permalink / raw)
To: Wilco Dijkstra, 'GNU C Library'
On 08/03/23 07:50, Wilco Dijkstra via Libc-alpha wrote:
>
> Remove memchr_strnlen since it is now the same as generic_strnlen. Adjust iteration
> count to reduce benchmark time.
>
> (I kept memchr_strlen since the generic strlen does not use memchr).
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
>
> ---
>
> diff --git a/benchtests/bench-strlen.c b/benchtests/bench-strlen.c
> index cae88dd6ec1794709fdf36a373896dd2d9d285dd..9b91f8a10ef0621cf2bc8310d8f08bd978b6d898 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_ITERS_LARGE;
> + size_t len = CALL (impl, s), i, iters = INNER_LOOP_ITERS8;
> timing_t start, stop, cur;
>
> if (len != exp_len)
> diff --git a/benchtests/bench-strnlen.c b/benchtests/bench-strnlen.c
> index c997d7da4c93b08070b718ef22cbd5582feeca09..a1840afa85c52dfecd35b1e4bb36d339b0866483 100644
> --- a/benchtests/bench-strnlen.c
> +++ b/benchtests/bench-strnlen.c
> @@ -22,7 +22,6 @@
> #else
> # define TEST_NAME "wcsnlen"
> # define generic_strnlen generic_wcsnlen
> -# define memchr_strnlen wcschr_wcsnlen
> #endif /* WIDE */
> #include "bench-string.h"
> #include "json-lib.h"
> @@ -38,22 +37,14 @@
> typedef size_t (*proto_t) (const CHAR *, size_t);
> size_t generic_strnlen (const CHAR *, size_t);
>
> -size_t
> -memchr_strnlen (const CHAR *s, size_t maxlen)
> -{
> - const CHAR *s1 = MEMCHR (s, 0, maxlen);
> - return (s1 == NULL) ? maxlen : s1 - s;
> -}
> -
> IMPL (STRNLEN, 1)
> -IMPL (memchr_strnlen, 0)
> IMPL (generic_strnlen, 0)
>
> static void
> do_one_test (json_ctx_t *json_ctx, 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_LARGE;
> + size_t len = CALL (impl, s, maxlen), i, iters = INNER_LOOP_ITERS;
> timing_t start, stop, cur;
>
> if (len != exp_len)
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-08 15:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 10:50 [PATCH] Benchtests: Remove memchr_strnlen Wilco Dijkstra
2023-03-08 15:18 ` Adhemerval Zanella Netto
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).