Re: Re: CRC

From: Bruce Guenter <bruceg(at)em(dot)ca>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Re: CRC
Date: 2000-12-09 05:46:26
Message-ID: 20001208234626.O9706@em.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 08, 2000 at 09:28:38PM -0500, Tom Lane wrote:
> 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.

Nope. They got 99-100% CPU time with the original version.

> I changed the main loop to this:
> [...hash each block repeatedly...]

Good idea. Might have been even better to just read the block once and
hash it even more times.

> 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?

The difference is likely because PA-RISC (like most other RISC
architectures) lack a "roll" opcode that is very prevalent in the MD5
algorithm. Intel CPUs have it. With a new version modified to repeat
the inner loop 100,000 times, I got the following:

time benchcrc <random
21.35user 0.01system 0:21.39elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (79major+11minor)pagefaults 0swaps
time benchmd5 <random
12.79user 0.01system 0:12.79elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (80major+11minor)pagefaults 0swaps
time benchcrc <random
21.32user 0.06system 0:21.52elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (79major+11minor)pagefaults 0swaps
time benchmd5 <random
12.79user 0.01system 0:12.80elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (80major+11minor)pagefaults 0swaps
--
Bruce Guenter <bruceg(at)em(dot)ca> http://em.ca/~bruceg/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-12-09 05:59:31 Re: Using Threads?
Previous Message Bruce Momjian 2000-12-09 05:26:15 Re: Using Threads?