mirror of git://sourceware.org/git/glibc.git
Benchtests: Remove memchr_strnlen
Remove memchr_strnlen since it is now the same as generic_strnlen. Adjust iteration count to reduce benchmark time. Keep memchr_strlen since the generic strlen does not use memchr. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
dcfcb8e392
commit
b0e02d5b6d
|
|
@ -48,7 +48,7 @@ IMPL (STRLEN, 1)
|
||||||
static void
|
static void
|
||||||
do_one_test (json_ctx_t *json_ctx, impl_t *impl, const CHAR *s, size_t exp_len)
|
do_one_test (json_ctx_t *json_ctx, impl_t *impl, const CHAR *s, size_t exp_len)
|
||||||
{
|
{
|
||||||
size_t len = CALL (impl, s), i, iters = INNER_LOOP_ITERS_LARGE;
|
size_t len = CALL (impl, s), i, iters = INNER_LOOP_ITERS8;
|
||||||
timing_t start, stop, cur;
|
timing_t start, stop, cur;
|
||||||
|
|
||||||
if (len != exp_len)
|
if (len != exp_len)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
#else
|
#else
|
||||||
# define TEST_NAME "wcsnlen"
|
# define TEST_NAME "wcsnlen"
|
||||||
# define generic_strnlen generic_wcsnlen
|
# define generic_strnlen generic_wcsnlen
|
||||||
# define memchr_strnlen wcschr_wcsnlen
|
|
||||||
#endif /* WIDE */
|
#endif /* WIDE */
|
||||||
#include "bench-string.h"
|
#include "bench-string.h"
|
||||||
#include "json-lib.h"
|
#include "json-lib.h"
|
||||||
|
|
@ -38,22 +37,14 @@
|
||||||
typedef size_t (*proto_t) (const CHAR *, size_t);
|
typedef size_t (*proto_t) (const CHAR *, size_t);
|
||||||
size_t generic_strnlen (const CHAR *, size_t);
|
size_t generic_strnlen (const CHAR *, size_t);
|
||||||
|
|
||||||
size_t
|
|
||||||
memchr_strnlen (const CHAR *s, size_t maxlen)
|
|
||||||
{
|
|
||||||
const CHAR *s1 = MEMCHR (s, 0, maxlen);
|
|
||||||
return (s1 == NULL) ? maxlen : s1 - s;
|
|
||||||
}
|
|
||||||
|
|
||||||
IMPL (STRNLEN, 1)
|
IMPL (STRNLEN, 1)
|
||||||
IMPL (memchr_strnlen, 0)
|
|
||||||
IMPL (generic_strnlen, 0)
|
IMPL (generic_strnlen, 0)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_one_test (json_ctx_t *json_ctx, impl_t *impl, const CHAR *s, size_t maxlen,
|
do_one_test (json_ctx_t *json_ctx, impl_t *impl, const CHAR *s, size_t maxlen,
|
||||||
size_t exp_len)
|
size_t exp_len)
|
||||||
{
|
{
|
||||||
size_t len = CALL (impl, s, maxlen), i, iters = INNER_LOOP_ITERS_LARGE;
|
size_t len = CALL (impl, s, maxlen), i, iters = INNER_LOOP_ITERS;
|
||||||
timing_t start, stop, cur;
|
timing_t start, stop, cur;
|
||||||
|
|
||||||
if (len != exp_len)
|
if (len != exp_len)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue