run hash benchmarks on various array sizes

This commit is contained in:
Sears Russell 2011-09-26 00:34:33 +00:00
parent e801554d5f
commit 6ebc39e54a

View file

@ -21,10 +21,14 @@ int main(int argc, char * argv[]) {
double elapsed = stasis_timeval_to_double(stasis_subtract_timeval(stop, start)); double elapsed = stasis_timeval_to_double(stasis_subtract_timeval(stop, start));
printf("Took %f seconds to write to 1GB (%f mb/sec)\n", elapsed, (1024.0)/elapsed); printf("Took %f seconds to write to 1GB (%f mb/sec)\n", elapsed, (1024.0)/elapsed);
gettimeofday(&start, 0); long len = 1;
stasis_crc32(foo, 1024*1024*1024, 0); for(long i = 0; i < 31; i++) {
gettimeofday(&stop, 0); gettimeofday(&start, 0);
stasis_crc32(foo, len, 0);
gettimeofday(&stop, 0);
elapsed = stasis_timeval_to_double(stasis_subtract_timeval(stop, start)); elapsed = stasis_timeval_to_double(stasis_subtract_timeval(stop, start));
printf("Took %f seconds to checksum 1GB (%f mb/sec)\n", elapsed, (1024.0)/elapsed); printf("Took %f seconds to checksum %ld bytes (%f mb/sec)\n", elapsed, len, ((double)len)/((1024.0*1024.0)*elapsed));
len *=2;
}
} }