mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
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>
This commit is contained in:
@ -47,22 +47,17 @@
|
||||
# ifndef WIDE
|
||||
# define STRPBRK strpbrk
|
||||
# define SIMPLE_STRPBRK simple_strpbrk
|
||||
# define STUPID_STRPBRK stupid_strpbrk
|
||||
# else
|
||||
# include <wchar.h>
|
||||
# define STRPBRK wcspbrk
|
||||
# define SIMPLE_STRPBRK simple_wcspbrk
|
||||
# define STUPID_STRPBRK stupid_wcspbrk
|
||||
# endif /* WIDE */
|
||||
|
||||
typedef CHAR *(*proto_t) (const CHAR *, const CHAR *);
|
||||
CHAR *SIMPLE_STRPBRK (const CHAR *, const CHAR *);
|
||||
CHAR *STUPID_STRPBRK (const CHAR *, const CHAR *);
|
||||
|
||||
IMPL (STUPID_STRPBRK, 0)
|
||||
IMPL (SIMPLE_STRPBRK, 0)
|
||||
IMPL (STRPBRK, 1)
|
||||
|
||||
/* Naive implementation to verify results. */
|
||||
CHAR *
|
||||
SIMPLE_STRPBRK (const CHAR *s, const CHAR *rej)
|
||||
{
|
||||
@ -72,22 +67,10 @@ SIMPLE_STRPBRK (const CHAR *s, const CHAR *rej)
|
||||
while ((c = *s++) != '\0')
|
||||
for (r = rej; *r != '\0'; ++r)
|
||||
if (*r == c)
|
||||
return (CHAR *) s - 1;
|
||||
return (CHAR *) s - 1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CHAR *
|
||||
STUPID_STRPBRK (const CHAR *s, const CHAR *rej)
|
||||
{
|
||||
size_t ns = STRLEN (s), nrej = STRLEN (rej);
|
||||
size_t i, j;
|
||||
|
||||
for (i = 0; i < ns; ++i)
|
||||
for (j = 0; j < nrej; ++j)
|
||||
if (s[i] == rej[j])
|
||||
return (CHAR *) s + i;
|
||||
return NULL;
|
||||
}
|
||||
#endif /* !STRPBRK_RESULT */
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user