public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Wilco Dijkstra <wilco@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc] Benchtests: Remove simple_str(n)casecmp Date: Wed, 8 Mar 2023 18:46:56 +0000 (GMT) [thread overview] Message-ID: <20230308184656.832A638582BE@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9ab7c42387409d5cf8facd0a56cfd98ce55b8cc3 commit 9ab7c42387409d5cf8facd0a56cfd98ce55b8cc3 Author: Wilco Dijkstra <wilco.dijkstra@arm.com> Date: Fri Mar 3 13:21:05 2023 +0000 Benchtests: Remove simple_str(n)casecmp Remove the slow byte oriented loops. Adjust iteration count to reduce benchmark time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Diff: --- benchtests/bench-strcasecmp.c | 16 +--------------- benchtests/bench-strncasecmp.c | 23 +---------------------- 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/benchtests/bench-strcasecmp.c b/benchtests/bench-strcasecmp.c index fcfffdea42..abc6a216e3 100644 --- a/benchtests/bench-strcasecmp.c +++ b/benchtests/bench-strcasecmp.c @@ -23,28 +23,14 @@ #include "json-lib.h" typedef int (*proto_t) (const char *, const char *); -static int simple_strcasecmp (const char *, const char *); -IMPL (simple_strcasecmp, 0) IMPL (strcasecmp, 1) -static int -simple_strcasecmp (const char *s1, const char *s2) -{ - int ret; - - while ((ret = ((unsigned char) tolower (*s1) - - (unsigned char) tolower (*s2))) == 0 - && *s1++) - ++s2; - return ret; -} - static void 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; int result = CALL (impl, s1, s2); if ((exp_result == 0 && result != 0) diff --git a/benchtests/bench-strncasecmp.c b/benchtests/bench-strncasecmp.c index 5689a22901..051c17d9f7 100644 --- a/benchtests/bench-strncasecmp.c +++ b/benchtests/bench-strncasecmp.c @@ -23,35 +23,14 @@ #include "json-lib.h" typedef int (*proto_t) (const char *, const char *, size_t); -static int simple_strncasecmp (const char *, const char *, size_t); -IMPL (simple_strncasecmp, 0) IMPL (strncasecmp, 1) -static int -simple_strncasecmp (const char *s1, const char *s2, size_t n) -{ - int ret; - - if (n == 0) - return 0; - - while ((ret = ((unsigned char) tolower (*s1) - - (unsigned char) tolower (*s2))) == 0 - && *s1++) - { - if (--n == 0) - return 0; - ++s2; - } - return ret; -} - 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);
reply other threads:[~2023-03-08 18:46 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230308184656.832A638582BE@sourceware.org \ --to=wilco@sourceware.org \ --cc=glibc-cvs@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: linkBe 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).