Re: Re: CRC

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Guenter <bruceg(at)em(dot)ca>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: CRC
Date: 2000-12-09 02:28:38
Message-ID: 9919.976328918@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Guenter <bruceg(at)em(dot)ca> writes:
>> I agree, don't send it to the whole list. But I'd like a copy.

> Here you go.

As near as I could tell, the test as you have it (one CRC computation per
fread) is purely I/O bound. I changed the main loop to this:

int main() {
static char buf[8192];
size_t rd;
hash_t hash;

while (rd = fread(buf, 1, sizeof buf, stdin)) {
int i;
for (i = 0; i < 1000; i++) {
init(&hash);
update(&hash, buf, rd);
}
}
return 0;
}

so as to get a reasonable amount of computation per fread. On an
otherwise idle HP 9000 C180 machine, I get the following numbers on a
1MB input file:

time benchcrc <random32

real 35.3
user 35.0
sys 0.0

time benchmd5 <random32

real 37.6
user 37.3
sys 0.0

This is a lot closer than I'd have expected, but it sure ain't
"MD5 40% faster" as you reported. I wonder why the difference
in results between your platform and mine?

BTW, I used gcc 2.95.2 to compile, -O6, no other switches.

regards, tom lane

In response to

Responses

  • Re: Re: CRC at 2000-12-09 05:46:26 from Bruce Guenter

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniele Orlandi 2000-12-09 02:31:27 Re: European Datestyle
Previous Message mlw 2000-12-09 02:07:22 Re: OK, does anyone have any better ideas?