about summary refs log tree commit diff
path: root/benchtests/bench-memrchr.c
diff options
context:
space:
mode:
authorWilco Dijkstra <wilco.dijkstra@arm.com>2023-03-03 12:54:45 +0000
committerWilco Dijkstra <wilco.dijkstra@arm.com>2023-03-08 18:36:25 +0000
commitdcfcb8e3928f68706e2bfa7527de363a899d2a69 (patch)
treee6c0676c34c7be018b41162a2a3c1ed0bfd6897d /benchtests/bench-memrchr.c
parent73a284f618aa81d2bd1f93b299ac5dbf95f396b1 (diff)
downloadglibc-dcfcb8e3928f68706e2bfa7527de363a899d2a69.tar.gz
glibc-dcfcb8e3928f68706e2bfa7527de363a899d2a69.tar.xz
glibc-dcfcb8e3928f68706e2bfa7527de363a899d2a69.zip
Benchtests: Remove simple_mem(r)chr
Instead of benchmarking slow byte oriented loops, include the optimized
generic memchr/memrchr implementation.  Adjust iteration count to reduce
benchmark time.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'benchtests/bench-memrchr.c')
-rw-r--r--benchtests/bench-memrchr.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/benchtests/bench-memrchr.c b/benchtests/bench-memrchr.c
index 4f594ee7cd..1f8c884503 100644
--- a/benchtests/bench-memrchr.c
+++ b/benchtests/bench-memrchr.c
@@ -21,20 +21,12 @@
 #include "bench-string.h"
 
 typedef char *(*proto_t) (const char *, int, size_t);
-char *simple_memrchr (const char *, int, size_t);
 
-IMPL (simple_memrchr, 0)
-IMPL (memrchr, 1)
+void *
+generic_memrchr (const void *, int, size_t);
 
-char *
-simple_memrchr (const char *s, int c, size_t n)
-{
-  s = s + n;
-  while (n--)
-    if (*--s == (char) c)
-      return (char *) s;
-  return NULL;
-}
+IMPL (memrchr, 1)
+IMPL (generic_memrchr, 0)
 
 #define USE_AS_MEMRCHR
 #include "bench-memchr.c"