diff options
author | Wilco Dijkstra <wdijkstr@arm.com> | 2019-04-09 11:54:34 +0100 |
---|---|---|
committer | Wilco Dijkstra <wdijkstr@arm.com> | 2019-04-09 11:54:34 +0100 |
commit | 648279f4af423c4783ec1dfa63cb7b46a7640217 (patch) | |
tree | fb9277130379baddc55546b600f2c1b0d4b947ad /benchtests/bench-strcat.c | |
parent | 93eebae5168e5cf2abfb4b6266e3fb2ab860cd60 (diff) | |
download | glibc-648279f4af423c4783ec1dfa63cb7b46a7640217.tar.gz |
Improve string benchtests
Replace slow byte-oriented tests in several string benchmarks with the
generic implementations from the string/ directory so the comparisons
are more realistic and useful.
* benchtests/bench-stpcpy.c (SIMPLE_STPCPY): Remove function.
(generic_stpcpy): New function.
* benchtests/bench-stpncpy.c (SIMPLE_STPNCPY): Remove function.
(generic_stpncpy): New function.
* benchtests/bench-strcat.c (SIMPLE_STRCAT): Remove function.
(generic_strcat): New function.
* benchtests/bench-strcpy.c (SIMPLE_STRCPY): Remove function.
(generic_strcpy): New function.
* benchtests/bench-strncat.c (SIMPLE_STRNCAT): Remove function.
(STUPID_STRNCAT): Remove function.
(generic_strncat): New function.
* benchtests/bench-strncpy.c (SIMPLE_STRNCPY): Remove function.
(STUPID_STRNCPY): Remove function.
(generic_strncpy): New function.
* benchtests/bench-strnlen.c (SIMPLE_STRNLEN): Remove function.
(generic_strnlen): New function.
(memchr_strnlen): New function.
* benchtests/bench-strlen.c (generic_strlen): Define for WIDE.
(memchr_strlen): Likewise.
Diffstat (limited to 'benchtests/bench-strcat.c')
-rw-r--r-- | benchtests/bench-strcat.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/benchtests/bench-strcat.c b/benchtests/bench-strcat.c index a21d94a28e..39d9fefb09 100644 --- a/benchtests/bench-strcat.c +++ b/benchtests/bench-strcat.c @@ -21,6 +21,7 @@ # define TEST_NAME "strcat" #else # define TEST_NAME "wcscat" +# define generic_strcat generic_wcscat #endif /* WIDE */ #include "bench-string.h" @@ -28,31 +29,25 @@ #ifndef WIDE # define sfmt "s" -# define SIMPLE_STRCAT simple_strcat # define SMALL_CHAR 127 #else # define sfmt "ls" -# define SIMPLE_STRCAT simple_wcscat # define SMALL_CHAR 1273 #endif /* WIDE */ typedef CHAR *(*proto_t) (CHAR *, const CHAR *); -CHAR *SIMPLE_STRCAT (CHAR *, const CHAR *); - -IMPL (SIMPLE_STRCAT, 0) -IMPL (STRCAT, 1) CHAR * -SIMPLE_STRCAT (CHAR *dst, const CHAR *src) +generic_strcat (CHAR *dst, const CHAR *src) { - CHAR *ret = dst; - while (*dst++ != '\0'); - --dst; - while ((*dst++ = *src++) != '\0'); - return ret; + STRCPY (dst + STRLEN (dst), src); + return dst; } +IMPL (STRCAT, 1) +IMPL (generic_strcat, 0) + static void do_one_test (impl_t *impl, CHAR *dst, const CHAR *src) { |