benchmark performance given unaligned memory

This commit is contained in:
Heng Li 2011-04-17 22:06:31 -04:00
parent 5b2ce9cd46
commit d37245b761
1 changed files with 15 additions and 0 deletions

View File

@ -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();