From 67e3b0c63c35769c1ba28fa2a32446332bb4fcef Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Wed, 6 Apr 2022 20:53:24 +0530 Subject: 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 Reviewed-by: Noah Goldstein --- string/test-strspn.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'string/test-strspn.c') diff --git a/string/test-strspn.c b/string/test-strspn.c index 1680cb7..a9c4245 100644 --- a/string/test-strspn.c +++ b/string/test-strspn.c @@ -29,7 +29,6 @@ # define CHAR char # define UCHAR unsigned char # define SIMPLE_STRSPN simple_strspn -# define STUPID_STRSPN stupid_strspn # define STRLEN strlen # define STRCHR strchr # define BIG_CHAR CHAR_MAX @@ -40,7 +39,6 @@ # define CHAR wchar_t # define UCHAR wchar_t # define SIMPLE_STRSPN simple_wcsspn -# define STUPID_STRSPN stupid_wcsspn # define STRLEN wcslen # define STRCHR wcschr # define BIG_CHAR WCHAR_MAX @@ -48,13 +46,10 @@ #endif /* WIDE */ typedef size_t (*proto_t) (const CHAR *, const CHAR *); -size_t SIMPLE_STRSPN (const CHAR *, const CHAR *); -size_t STUPID_STRSPN (const CHAR *, const CHAR *); -IMPL (STUPID_STRSPN, 0) -IMPL (SIMPLE_STRSPN, 0) IMPL (STRSPN, 1) +/* Naive implementation to verify results. */ size_t SIMPLE_STRSPN (const CHAR *s, const CHAR *acc) { @@ -72,23 +67,6 @@ SIMPLE_STRSPN (const CHAR *s, const CHAR *acc) return s - str - 1; } -size_t -STUPID_STRSPN (const CHAR *s, const CHAR *acc) -{ - size_t ns = STRLEN (s), nacc = STRLEN (acc); - size_t i, j; - - for (i = 0; i < ns; ++i) - { - for (j = 0; j < nacc; ++j) - if (s[i] == acc[j]) - break; - if (j == nacc) - return i; - } - return i; -} - static void do_one_test (impl_t *impl, const CHAR *s, const CHAR *acc, size_t exp_res) { -- cgit v1.1