diff options
author | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2017-09-14 22:39:49 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2017-09-14 22:54:24 +0530 |
commit | 503c92c37a95f769762e65aff9383b302178c2bc (patch) | |
tree | 6374607403822c719c9e0719e549478b378557c0 /benchtests/bench-memset.c | |
parent | 29c933fb35b7bf872f57dc6977c879832983ab6c (diff) | |
download | glibc-503c92c37a95f769762e65aff9383b302178c2bc.zip glibc-503c92c37a95f769762e65aff9383b302178c2bc.tar.gz glibc-503c92c37a95f769762e65aff9383b302178c2bc.tar.bz2 |
benchtests: Reallocate buffers for memset
Keeping the same buffers along with copying the same size of data into
the same location means that the first routine is typically the
slowest since it has to bear the cost of fetching data into to cache.
Reallocating buffers stabilizes numbers by a bit.
* benchtests/bench-string.h (realloc_bufs): New function.
(test_init): Call it.
* benchtests/bench-memset-large.c (do_test): Likewise.
* benchtests/bench-memset.c (do_test): Likewise.
Diffstat (limited to 'benchtests/bench-memset.c')
-rw-r--r-- | benchtests/bench-memset.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c index 107e2b7..724c105 100644 --- a/benchtests/bench-memset.c +++ b/benchtests/bench-memset.c @@ -132,7 +132,10 @@ do_test (json_ctx_t *json_ctx, size_t align, int c, size_t len) json_array_begin (json_ctx, "timings"); FOR_EACH_IMPL (impl, 0) - do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c, len); + { + do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c, len); + realloc_bufs (); + } json_array_end (json_ctx); json_element_object_end (json_ctx); |