about summary refs log tree commit diff
path: root/benchtests/bench-strtok.c
diff options
context:
space:
mode:
authorWilco Dijkstra <wilco.dijkstra@arm.com>2023-03-03 13:03:19 +0000
committerWilco Dijkstra <wilco.dijkstra@arm.com>2023-03-08 18:36:48 +0000
commit5de1508803bd1beeadd370ebac19e43b3232380b (patch)
tree763df389ac94b44743b13da43f3bc4d96a13bf2d /benchtests/bench-strtok.c
parentb0e02d5b6d65cdfc972494484ef9a67b8e55e8f0 (diff)
downloadglibc-5de1508803bd1beeadd370ebac19e43b3232380b.tar.gz
glibc-5de1508803bd1beeadd370ebac19e43b3232380b.tar.xz
glibc-5de1508803bd1beeadd370ebac19e43b3232380b.zip
Benchtests: Remove simple_strcspn/strpbrk/strsep
Remove simple_strcspn/strpbrk/strsep which are significantly slower than the
generic implementations.  Also remove oldstrsep and oldstrtok since they are
practically identical to the generic implementation.  Adjust iteration count
to reduce benchmark time.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'benchtests/bench-strtok.c')
-rw-r--r--benchtests/bench-strtok.c36
1 files changed, 1 insertions, 35 deletions
diff --git a/benchtests/bench-strtok.c b/benchtests/bench-strtok.c
index 711bdaab58..b5789d7bf2 100644
--- a/benchtests/bench-strtok.c
+++ b/benchtests/bench-strtok.c
@@ -20,47 +20,14 @@
 #define TEST_NAME "strtok"
 #include "bench-string.h"
 
-char *
-oldstrtok (char *s, const char *delim)
-{
-  static char *olds;
-  char *token;
-
-  if (s == NULL)
-    s = olds;
-
-  /* Scan leading delimiters.  */
-  s += strspn (s, delim);
-  if (*s == '\0')
-    {
-      olds = s;
-      return NULL;
-    }
-
-  /* Find the end of the token.  */
-  token = s;
-  s = strpbrk (token, delim);
-  if (s == NULL)
-    /* This token finishes the string.  */
-    olds = strchr (token, '\0');
-  else
-    {
-      /* Terminate the token and make OLDS point past it.  */
-      *s = '\0';
-      olds = s + 1;
-    }
-  return token;
-}
-
 typedef char *(*proto_t) (const char *, const char *);
 
-IMPL (oldstrtok, 0)
 IMPL (strtok, 1)
 
 static void
 do_one_test (impl_t * impl, const char *s1, const char *s2)
 {
-  size_t i, iters = INNER_LOOP_ITERS_SMALL;
+  size_t i, iters = INNER_LOOP_ITERS_MEDIUM;
   timing_t start, stop, cur;
   TIMING_NOW (start);
   for (i = 0; i < iters; ++i)
@@ -74,7 +41,6 @@ do_one_test (impl_t * impl, const char *s1, const char *s2)
   TIMING_DIFF (cur, start, stop);
 
   TIMING_PRINT_MEAN ((double) cur, (double) iters);
-
 }