mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-11 11:50:06 +00:00
Improve string benchtest timing
Improve string benchtest timing. Many tests run for 0.01s which is way too short to give accurate results. Other tests take over 40 seconds which is way too long. Significantly increase the iterations of the short running tests. Reduce number of alignment variations in the long running memcpy walk tests so they take less than 5 seconds. As a result most tests take at least 0.1s and all finish within 5 seconds. * benchtests/bench-memcpy-random.c (do_one_test): Use medium iterations. * benchtests/bench-memcpy-walk.c (test_main): Reduce alignment tests. * benchtests/bench-memmem.c (do_one_test): Use small iterations. * benchtests/bench-memmove-walk.c (test_main): Reduce alignment tests. * benchtests/bench-memset-walk.c (test_main): Reduce alignment tests. * benchtests/bench-strcasestr.c (do_one_test): Use small iterations. * benchtests/bench-string.h (INNER_LOOP_ITERS): Increase iterations. (INNER_LOOP_ITERS_MEDIUM): New define. (INNER_LOOP_ITERS_SMALL): New define. * benchtests/bench-strpbrk.c (do_one_test): Use medium iterations. * benchtests/bench-strsep.c (do_one_test): Use small iterations. * benchtests/bench-strspn.c (do_one_test): Use medium iterations. * benchtests/bench-strstr.c (do_one_test): Use small iterations. * benchtests/bench-strtok.c (do_one_test): Use small iterations.
This commit is contained in:
parent
004e52febf
commit
46ae07324b
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
||||
2019-05-21 Wilco Dijkstra <wdijkstr@arm.com>
|
||||
|
||||
* benchtests/bench-memcpy-random.c (do_one_test): Use medium iterations.
|
||||
* benchtests/bench-memcpy-walk.c (test_main): Reduce alignment tests.
|
||||
* benchtests/bench-memmem.c (do_one_test): Use small iterations.
|
||||
* benchtests/bench-memmove-walk.c (test_main): Reduce alignment tests.
|
||||
* benchtests/bench-memset-walk.c (test_main): Reduce alignment tests.
|
||||
* benchtests/bench-strcasestr.c (do_one_test): Use small iterations.
|
||||
* benchtests/bench-string.h (INNER_LOOP_ITERS): Increase iterations.
|
||||
(INNER_LOOP_ITERS_MEDIUM): New define.
|
||||
(INNER_LOOP_ITERS_SMALL): New define.
|
||||
* benchtests/bench-strpbrk.c (do_one_test): Use medium iterations.
|
||||
* benchtests/bench-strsep.c (do_one_test): Use small iterations.
|
||||
* benchtests/bench-strspn.c (do_one_test): Use medium iterations.
|
||||
* benchtests/bench-strstr.c (do_one_test): Use small iterations.
|
||||
* benchtests/bench-strtok.c (do_one_test): Use small iterations.
|
||||
|
||||
2019-05-21 Adhemeval Zanella <adhemerval.zanella@linaro.org>
|
||||
|
||||
* sysdeps/unix/sysv/linux/powerpc/ipc_priv.h (SEMTIMEDOP_IPC_ARGS):
|
||||
|
@ -101,7 +101,7 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src,
|
||||
copy_t *copy, size_t n)
|
||||
{
|
||||
timing_t start, stop, cur;
|
||||
size_t iters = INNER_LOOP_ITERS * 20;
|
||||
size_t iters = INNER_LOOP_ITERS_MEDIUM;
|
||||
|
||||
TIMING_NOW (start);
|
||||
for (int i = 0; i < iters; ++i)
|
||||
|
@ -103,12 +103,8 @@ test_main (void)
|
||||
json_array_begin (&json_ctx, "results");
|
||||
for (size_t i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1)
|
||||
{
|
||||
/* Test length alignments from 0-16 bytes. */
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
do_test (&json_ctx, i + j);
|
||||
do_test (&json_ctx, i + 16 - j);
|
||||
}
|
||||
do_test (&json_ctx, i);
|
||||
do_test (&json_ctx, i + 1);
|
||||
}
|
||||
|
||||
json_array_end (&json_ctx);
|
||||
|
@ -105,7 +105,7 @@ static void
|
||||
do_one_test (impl_t *impl, const void *haystack, size_t haystack_len,
|
||||
const void *needle, size_t needle_len, const void *expected)
|
||||
{
|
||||
size_t i, iters = INNER_LOOP_ITERS;
|
||||
size_t i, iters = INNER_LOOP_ITERS_SMALL;
|
||||
timing_t start, stop, cur;
|
||||
|
||||
TIMING_NOW (start);
|
||||
|
@ -107,23 +107,15 @@ test_main (void)
|
||||
/* Non-overlapping buffers. */
|
||||
for (size_t i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1)
|
||||
{
|
||||
/* Test length alignments from 0-16 bytes. */
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
do_test (&json_ctx, i + j, false);
|
||||
do_test (&json_ctx, i + 16 - j, false);
|
||||
}
|
||||
do_test (&json_ctx, i, false);
|
||||
do_test (&json_ctx, i + 1, false);
|
||||
}
|
||||
|
||||
/* Overlapping buffers. */
|
||||
for (size_t i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1)
|
||||
{
|
||||
/* Test length alignments from 0-16 bytes. */
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
do_test (&json_ctx, i + j, true);
|
||||
do_test (&json_ctx, i + 16 - j, true);
|
||||
}
|
||||
do_test (&json_ctx, i, true);
|
||||
do_test (&json_ctx, i + 1, true);
|
||||
}
|
||||
|
||||
json_array_end (&json_ctx);
|
||||
|
@ -112,13 +112,16 @@ test_main (void)
|
||||
|
||||
json_array_begin (&json_ctx, "results");
|
||||
for (i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1)
|
||||
/* Test length alignments from 0-16 bytes. */
|
||||
for (int j = 0; j < i && j < 16; j++)
|
||||
do_test (&json_ctx, 65, i + j);
|
||||
{
|
||||
do_test (&json_ctx, 65, i);
|
||||
do_test (&json_ctx, 65, i + 1);
|
||||
}
|
||||
|
||||
for (i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1)
|
||||
for (int j = 0; j < i && j < 16; j++)
|
||||
do_test (&json_ctx, 0, i + j);
|
||||
{
|
||||
do_test (&json_ctx, 0, i);
|
||||
do_test (&json_ctx, 0, i + 1);
|
||||
}
|
||||
|
||||
json_array_end (&json_ctx);
|
||||
json_attr_object_end (&json_ctx);
|
||||
|
@ -36,7 +36,7 @@ IMPL (strcasestr, 1)
|
||||
static void
|
||||
do_one_test (impl_t *impl, const char *s1, const char *s2, char *exp_result)
|
||||
{
|
||||
size_t i, iters = INNER_LOOP_ITERS;
|
||||
size_t i, iters = INNER_LOOP_ITERS_SMALL;
|
||||
timing_t start, stop, cur;
|
||||
|
||||
TIMING_NOW (start);
|
||||
|
@ -124,7 +124,9 @@ extern impl_t __start_impls[], __stop_impls[];
|
||||
# define OPT_RANDOM 10001
|
||||
# define OPT_SEED 10002
|
||||
|
||||
# define INNER_LOOP_ITERS 64
|
||||
# define INNER_LOOP_ITERS 8192
|
||||
# define INNER_LOOP_ITERS_MEDIUM 1024
|
||||
# define INNER_LOOP_ITERS_SMALL 32
|
||||
|
||||
int ret, do_srandom;
|
||||
unsigned int seed;
|
||||
|
@ -66,7 +66,7 @@ static void
|
||||
do_one_test (impl_t *impl, const CHAR *s, const CHAR *rej, RES_TYPE exp_res)
|
||||
{
|
||||
RES_TYPE res = CALL (impl, s, rej);
|
||||
size_t i, iters = INNER_LOOP_ITERS;
|
||||
size_t i, iters = INNER_LOOP_ITERS_MEDIUM;
|
||||
timing_t start, stop, cur;
|
||||
|
||||
if (res != exp_res)
|
||||
|
@ -103,7 +103,7 @@ IMPL (oldstrsep, 2)
|
||||
static void
|
||||
do_one_test (impl_t * impl, const char *s1, const char *s2)
|
||||
{
|
||||
size_t i, iters = INNER_LOOP_ITERS;
|
||||
size_t i, iters = INNER_LOOP_ITERS_SMALL;
|
||||
timing_t start, stop, cur;
|
||||
|
||||
TIMING_NOW (start);
|
||||
|
@ -60,7 +60,7 @@ SIMPLE_STRSPN (const CHAR *s, const CHAR *acc)
|
||||
static void
|
||||
do_one_test (impl_t *impl, const CHAR *s, const CHAR *acc, size_t exp_res)
|
||||
{
|
||||
size_t res = CALL (impl, s, acc), i, iters = INNER_LOOP_ITERS;
|
||||
size_t res = CALL (impl, s, acc), i, iters = INNER_LOOP_ITERS_MEDIUM;
|
||||
timing_t start, stop, cur;
|
||||
|
||||
if (res != exp_res)
|
||||
|
@ -131,7 +131,7 @@ IMPL (basic_strstr, 0)
|
||||
static void
|
||||
do_one_test (impl_t *impl, const char *s1, const char *s2, char *exp_result)
|
||||
{
|
||||
size_t i, iters = INNER_LOOP_ITERS;
|
||||
size_t i, iters = INNER_LOOP_ITERS_SMALL;
|
||||
timing_t start, stop, cur;
|
||||
char *res;
|
||||
|
||||
|
@ -60,7 +60,7 @@ IMPL (strtok, 1)
|
||||
static void
|
||||
do_one_test (impl_t * impl, const char *s1, const char *s2)
|
||||
{
|
||||
size_t i, iters = INNER_LOOP_ITERS;
|
||||
size_t i, iters = INNER_LOOP_ITERS_SMALL;
|
||||
timing_t start, stop, cur;
|
||||
TIMING_NOW (start);
|
||||
for (i = 0; i < iters; ++i)
|
||||
|
Loading…
Reference in New Issue
Block a user