From 6ebc39e54a3eca75dcc5759050664654acd9e004 Mon Sep 17 00:00:00 2001 From: Sears Russell Date: Mon, 26 Sep 2011 00:34:33 +0000 Subject: [PATCH] run hash benchmarks on various array sizes --- benchmarks/hashPerformance.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/benchmarks/hashPerformance.c b/benchmarks/hashPerformance.c index 14a2a38..fc9705d 100644 --- a/benchmarks/hashPerformance.c +++ b/benchmarks/hashPerformance.c @@ -21,10 +21,14 @@ int main(int argc, char * argv[]) { 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); - gettimeofday(&start, 0); - stasis_crc32(foo, 1024*1024*1024, 0); - gettimeofday(&stop, 0); + long len = 1; + for(long i = 0; i < 31; i++) { + gettimeofday(&start, 0); + stasis_crc32(foo, len, 0); + gettimeofday(&stop, 0); - 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); + elapsed = stasis_timeval_to_double(stasis_subtract_timeval(stop, start)); + printf("Took %f seconds to checksum %ld bytes (%f mb/sec)\n", elapsed, len, ((double)len)/((1024.0*1024.0)*elapsed)); + len *=2; + } }