diff options
author | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2022-04-06 20:53:24 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2022-04-06 20:53:24 +0530 |
commit | 67e3b0c63c35769c1ba28fa2a32446332bb4fcef (patch) | |
tree | 30222f7961103558c51c99871cead59139e65fd5 /string/test-strstr.c | |
parent | dfc7bf8a24f63532da167cc7131227c1c4027ffb (diff) | |
download | glibc-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-strstr.c')
-rw-r--r-- | string/test-strstr.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/string/test-strstr.c b/string/test-strstr.c index 7f610f4cac..b1f2134360 100644 --- a/string/test-strstr.c +++ b/string/test-strstr.c @@ -21,14 +21,14 @@ #include "test-string.h" -#define STRSTR simple_strstr +#define STRSTR c_strstr #define libc_hidden_builtin_def(arg) /* nothing */ #define __strnlen strnlen #include "strstr.c" - +/* Naive implementation to verify results. */ static char * -stupid_strstr (const char *s1, const char *s2) +simple_strstr (const char *s1, const char *s2) { ssize_t s1len = strlen (s1); ssize_t s2len = strlen (s2); @@ -52,8 +52,7 @@ stupid_strstr (const char *s1, const char *s2) typedef char *(*proto_t) (const char *, const char *); -IMPL (stupid_strstr, 0) -IMPL (simple_strstr, 0) +IMPL (c_strstr, 0) IMPL (strstr, 1) @@ -130,7 +129,7 @@ check1 (void) const char s2[] = "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD"; char *exp_result; - exp_result = stupid_strstr (s1, s2); + exp_result = simple_strstr (s1, s2); FOR_EACH_IMPL (impl, 0) check_result (impl, s1, s2, exp_result); } @@ -163,7 +162,7 @@ check2 (void) char *s2_page_cross = (void *) buf2 + page_size_real - 8; strcpy (s2_page_cross, s2_stack); - exp_result = stupid_strstr (s1_stack, s2_stack); + exp_result = simple_strstr (s1_stack, s2_stack); FOR_EACH_IMPL (impl, 0) { check_result (impl, s1_stack, s2_stack, exp_result); @@ -201,7 +200,7 @@ pr23637 (void) /* Ensure we don't match at the first 'x'. */ h[0] = 'x'; - char *exp_result = stupid_strstr (h, n); + char *exp_result = simple_strstr (h, n); FOR_EACH_IMPL (impl, 0) check_result (impl, h, n, exp_result); } |