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

@ -47,21 +47,16 @@
# include "test-string.h"
# ifndef WIDE
# define SIMPLE_STRNCPY simple_strncpy
# define STUPID_STRNCPY stupid_strncpy
# define STRNCPY strncpy
# else
# define SIMPLE_STRNCPY simple_wcsncpy
# define STUPID_STRNCPY stupid_wcsncpy
# define STRNCPY wcsncpy
# endif /* WIDE */
CHAR *SIMPLE_STRNCPY (CHAR *, const CHAR *, size_t);
CHAR *STUPID_STRNCPY (CHAR *, const CHAR *, size_t);
IMPL (STUPID_STRNCPY, 0)
IMPL (SIMPLE_STRNCPY, 0)
IMPL (STRNCPY, 1)
/* Naive implementation to verify results. */
CHAR *
SIMPLE_STRNCPY (CHAR *dst, const CHAR *src, size_t n)
{
@ -76,18 +71,6 @@ SIMPLE_STRNCPY (CHAR *dst, const CHAR *src, size_t n)
return ret;
}
CHAR *
STUPID_STRNCPY (CHAR *dst, const CHAR *src, size_t n)
{
size_t nc = STRNLEN (src, n);
size_t i;
for (i = 0; i < nc; ++i)
dst[i] = src[i];
for (; i < n; ++i)
dst[i] = '\0';
return dst;
}
#endif /* !STRNCPY_RESULT */
typedef CHAR *(*proto_t) (CHAR *, const CHAR *, size_t);