about summary refs log tree commit diff
path: root/string/test-strchr.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2022-04-06 20:53:24 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2022-04-06 20:53:24 +0530
commit67e3b0c63c35769c1ba28fa2a32446332bb4fcef (patch)
tree30222f7961103558c51c99871cead59139e65fd5 /string/test-strchr.c
parentdfc7bf8a24f63532da167cc7131227c1c4027ffb (diff)
downloadglibc-67e3b0c63c35769c1ba28fa2a32446332bb4fcef.tar.gz
glibc-67e3b0c63c35769c1ba28fa2a32446332bb4fcef.tar.xz
glibc-67e3b0c63c35769c1ba28fa2a32446332bb4fcef.zip
tests/string: Drop simple/stupid/builtin tests
In most cases the simple/stupid/builtin functions were in there to
benchmark optimized implementations against.  Only in some cases the
functions are used to check expected results.

Remove these tests from IMPL() and only keep them in wherever they're
used for a specific purpose, e.g. to generate expected results.

This improves timing of `make subdirs=string` by over a minute and a
half (over 15%) on a Whiskey Lake laptop.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Noah Goldstein <libc-alpha@sourceware.org>
Diffstat (limited to 'string/test-strchr.c')
-rw-r--r--string/test-strchr.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/string/test-strchr.c b/string/test-strchr.c
index 4d2ab5fbeb..631e377991 100644
--- a/string/test-strchr.c
+++ b/string/test-strchr.c
@@ -35,7 +35,6 @@
 #ifndef WIDE
 # ifdef USE_FOR_STRCHRNUL
 #  define STRCHR strchrnul
-#  define stupid_STRCHR stupid_STRCHRNUL
 #  define simple_STRCHR simple_STRCHRNUL
 # else
 #  define STRCHR strchr
@@ -51,7 +50,6 @@
 # include <wchar.h>
 # ifdef USE_FOR_STRCHRNUL
 #  define STRCHR wcschrnul
-#  define stupid_STRCHR stupid_WCSCHRNUL
 #  define simple_STRCHR simple_WCSCHRNUL
 # else
 #  define STRCHR wcschr
@@ -74,18 +72,10 @@
 
 typedef CHAR *(*proto_t) (const CHAR *, int);
 
+/* Naive implementation to verify results.  */
 CHAR *
 simple_STRCHR (const CHAR *s, int c)
 {
-  for (; *s != (CHAR) c; ++s)
-    if (*s == '\0')
-      return NULLRET ((CHAR *) s);
-  return (CHAR *) s;
-}
-
-CHAR *
-stupid_STRCHR (const CHAR *s, int c)
-{
   size_t n = STRLEN (s) + 1;
 
   while (n--)
@@ -94,8 +84,6 @@ stupid_STRCHR (const CHAR *s, int c)
   return NULLRET ((CHAR *) s - 1);
 }
 
-IMPL (stupid_STRCHR, 0)
-IMPL (simple_STRCHR, 0)
 IMPL (STRCHR, 1)
 
 static int
@@ -231,7 +219,7 @@ check1 (void)
 {
   CHAR s[] __attribute__((aligned(16))) = L ("\xff");
   CHAR c = L ('\xfe');
-  CHAR *exp_result = stupid_STRCHR (s, c);
+  CHAR *exp_result = simple_STRCHR (s, c);
 
   FOR_EACH_IMPL (impl, 0)
     check_result (impl, s, c, exp_result);