Re: New CRC algorithm: Slicing by 8 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: New CRC algorithm: Slicing by 8
Date
Msg-id 8671.1161554773@sss.pgh.pa.us
Whole thread Raw
In response to Re: New CRC algorithm: Slicing by 8  ("Gurjeet Singh" <singh.gurjeet@gmail.com>)
Responses Re: New CRC algorithm: Slicing by 8  (mark@mark.mielke.cc)
Re: New CRC algorithm: Slicing by 8  ("Simon Riggs" <simon@2ndquadrant.com>)
Re: New CRC algorithm: Slicing by 8  ("Gurjeet Singh" <singh.gurjeet@gmail.com>)
List pgsql-hackers
"Gurjeet Singh" <singh.gurjeet@gmail.com> writes:
>> If possible, people should test it on different platforms, so as to
>> ensure that it doesn't perform any worse than older implementation on any
>> supported platform (please post the results, if you do test it).

I didn't particularly trust the timing calculations in your benchmark
program, so I made up my own low-tech test version (attached).
I get the following timings for 1 million iterations of
INIT_CRC32/COMP_CRC32/FIN_CRC32 on different buffer sizes,
using "gcc -O2" on some machines laying about the house:

        Std CRC        Slice8 CRC

HPPA (HPUX 10.20)

8192 bytes    44.897212    35.191499
1024 bytes    5.639081    4.669850
64 bytes    0.377416    0.613195

PPC (Mac G4, Darwin 10.4.8)

8192 bytes    12.663135    12.158293
1024 bytes    1.579940    1.614967
64 bytes    0.104310    0.229401

Intel Xeon EM64T (Fedora Core 5)

8192 bytes    4.420879    7.633120
1024 bytes    0.571794    0.819372
64 bytes    0.047354    0.071906

Intel Pentium 4 (Fedora Core 5)

8192 bytes    6.942324    28.848572    (yes, really)
1024 bytes    0.905259    3.625360
64 bytes    0.068065    0.260224

It's worth pointing out that this test program is biased in favor of the
slice8 code about as far as it could possibly be: after the first
iteration, the remaining 999999 will find the cache as hot as possible.
Furthermore, the test doesn't exercise misaligned or odd-length cases,
which would incur extra start/stop overhead for slice8.

These numbers are um, not impressive.  Considering that a large fraction
of our WAL records are pretty short, the fact that slice8 consistently
loses at short buffer lengths is especially discouraging.  Much of that
ground could be made up perhaps with tenser coding of the initialization
and finalization code, but it'd still not be worth taking any legal risk
for AFAICS.

            regards, tom lane


Attachment

pgsql-hackers by date:

Previous
From: "Simon Riggs"
Date:
Subject: Re: xlogdump fixups and WAL log question.
Next
From: "Leendert Paul Diterwich"
Date:
Subject: Crosstab question