1
0
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:
Siddhesh Poyarekar
2022-04-06 20:53:24 +05:30
parent dfc7bf8a24
commit 67e3b0c63c
25 changed files with 43 additions and 230 deletions

View File

@ -29,12 +29,10 @@
typedef int (*proto_t) (const char *, const char *, size_t);
static int simple_strncasecmp (const char *, const char *, size_t);
static int stupid_strncasecmp (const char *, const char *, size_t);
IMPL (stupid_strncasecmp, 0)
IMPL (simple_strncasecmp, 0)
IMPL (strncasecmp, 1)
/* Naive implementation to verify results. */
static int
simple_strncasecmp (const char *s1, const char *s2, size_t n)
{
@ -54,27 +52,6 @@ simple_strncasecmp (const char *s1, const char *s2, size_t n)
return ret;
}
static int
stupid_strncasecmp (const char *s1, const char *s2, size_t max)
{
size_t ns1 = strlen (s1) + 1;
size_t ns2 = strlen (s2) + 1;
size_t n = ns1 < ns2 ? ns1 : ns2;
if (n > max)
n = max;
int ret = 0;
while (n--)
{
if ((ret = ((unsigned char) tolower (*s1)
- (unsigned char) tolower (*s2))) != 0)
break;
++s1;
++s2;
}
return ret;
}
static int
check_result (impl_t *impl, const char *s1, const char *s2, size_t n,
int exp_result)