diff options
author | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2018-08-16 14:09:56 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2018-08-16 14:11:57 +0530 |
commit | 34f86d61687457aa57d40cf3c230ca8404d40e45 (patch) | |
tree | 4d297d8c4c2c27a63414ceddddfae1a16506f5d9 /benchtests | |
parent | 953a5a4a59434ee316a091514e83e249aa25b09d (diff) | |
download | glibc-34f86d61687457aa57d40cf3c230ca8404d40e45.zip glibc-34f86d61687457aa57d40cf3c230ca8404d40e45.tar.gz glibc-34f86d61687457aa57d40cf3c230ca8404d40e45.tar.bz2 |
Reallocate buffers for every run in strlen
Try and avoid influencing performance of neighbouring functions.
Diffstat (limited to 'benchtests')
-rw-r--r-- | benchtests/bench-strlen.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/benchtests/bench-strlen.c b/benchtests/bench-strlen.c index 6782215..5768494 100644 --- a/benchtests/bench-strlen.c +++ b/benchtests/bench-strlen.c @@ -96,12 +96,6 @@ do_test (json_ctx_t *json_ctx, size_t align, size_t len) if (align + sizeof(CHAR) * len >= page_size) return; - CHAR *buf = (CHAR *) (buf1); - - for (i = 0; i < len; ++i) - buf[align + i] = 1 + 11111 * i % MAX_CHAR; - buf[align + len] = 0; - json_element_object_begin (json_ctx); json_attr_uint (json_ctx, "length", len); json_attr_uint (json_ctx, "alignment", align); @@ -109,7 +103,16 @@ do_test (json_ctx_t *json_ctx, size_t align, size_t len) FOR_EACH_IMPL (impl, 0) - do_one_test (json_ctx, impl, (CHAR *) (buf + align), len); + { + CHAR *buf = (CHAR *) (buf1); + + for (i = 0; i < len; ++i) + buf[align + i] = 1 + 11111 * i % MAX_CHAR; + buf[align + len] = 0; + + do_one_test (json_ctx, impl, (CHAR *) (buf + align), len); + alloc_bufs (); + } json_array_end (json_ctx); json_element_object_end (json_ctx); |