From 4d7632ff687dc60fb9ed38bae682d395017b61a8 Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Mon, 20 Nov 2017 17:55:59 +0530 Subject: benchtests: Fix walking sizes and directions for *-walk benchmarks Make the walking benchmarks walk only backwards since copying both ways is biased in favour of implementations that use non-temporal stores for larger sizes; falkor is one of them. This also fixes up bugs in computation of the result which ended up multiplying the length with the timing result unnecessarily. * benchtests/bench-memcpy-walk.c (do_one_test): Copy only backwards. Fix timing computation. * benchtests/bench-memmove-walk.c (do_one_test): Likewise. * benchtests/bench-memset-walk.c (do_one_test): Walk backwards on memset by N at a time. Fix timing computation. --- benchtests/bench-memcpy-walk.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'benchtests/bench-memcpy-walk.c') diff --git a/benchtests/bench-memcpy-walk.c b/benchtests/bench-memcpy-walk.c index 69d467d3fe..5b563411ad 100644 --- a/benchtests/bench-memcpy-walk.c +++ b/benchtests/bench-memcpy-walk.c @@ -47,26 +47,22 @@ static void do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src, size_t len) { - size_t i, iters = MIN_PAGE_SIZE / len; + size_t i = 0; timing_t start, stop, cur; char *dst_end = dst + MIN_PAGE_SIZE - len; char *src_end = src + MIN_PAGE_SIZE - len; TIMING_NOW (start); - /* Copy the entire buffer back and forth, LEN at a time. */ - for (i = 0; i < iters && dst_end >= dst && src <= src_end; src++, dst_end--) - { - CALL (impl, dst_end, src, len); - CALL (impl, src, dst_end, len); - i += 2; - } + /* Copy the entire buffer backwards, LEN at a time. */ + for (; src_end >= src && dst_end >= dst; src_end -= len, dst_end -= len, i++) + CALL (impl, src_end, dst_end, len); TIMING_NOW (stop); TIMING_DIFF (cur, start, stop); /* Get time taken per function call. */ - json_element_double (json_ctx, (double) cur * len / i); + json_element_double (json_ctx, (double) cur / i); } static void -- cgit 1.4.1