From d37245b761c212e33d28d31bb6443c7f4f824a11 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Sun, 17 Apr 2011 22:06:31 -0400 Subject: [PATCH] benchmark performance given unaligned memory --- ksort_test.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ksort_test.c b/ksort_test.c index f34f63a..92c7d3d 100644 --- a/ksort_test.c +++ b/ksort_test.c @@ -34,6 +34,21 @@ int main(int argc, char *argv[]) } } +#ifndef _ALIGNED_ONLY + { // test unaligned ksmall + srand48(11); + unsigned char *a; + int *b; + a = malloc(N * sizeof(int) + 1); + b = (int*)(a + 1); + for (i = 0; i < N; ++i) b[i] = (int)lrand48(); + t1 = clock(); + ks_introsort(int, N, b); + t2 = clock(); + fprintf(stderr, "introsort [%d]: %.3lf (unaligned: 0x%lx) \n", b[10500], (double)(t2-t1)/CLOCKS_PER_SEC, (size_t)b); + } +#endif + t1 = clock(); ks_introsort(int, N, array); t2 = clock(); -- 2.47.3