Re: Cost of XLogInsert CRC calculations

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Mark Cave-Ayland <m(dot)cave-ayland(at)webbased(dot)co(dot)uk>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Cost of XLogInsert CRC calculations
Date: 2005-05-18 11:50:22
Message-ID: aq9m81l2k5br7rahcf9lvc9jj11lbodf09@email.aon.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 18 May 2005 01:12:26 -0400, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Wait, par for 32-bit CRCs? Or for 64-bit CRCs calculated using 32-bit ints?
>
>Right, the latter. We haven't actually tried to measure the cost of
>plain 32bit CRCs... although I seem to recall that when we originally
>decided to use 64bit, someone put up some benchmarks purporting to
>show that there wasn't much difference.

That someone wasn't me (I wasn't around here at that time), but I have
done a few tests today on 32 bit Intel with VC6:

Optimization | CRC algorithms
Settings | 32 32a 32b 2x32 64 64a 64b
-------------+-----------------------------------------------
Default | 7.6 7.6 6.2 8.3 9.1 9.2 9.5
MinSize | 2.96 2.97 2.97 4.76 6.00 5.98 6.31
MaxSpeed | 2.92 2.92 2.97 3.13 6.32 6.33 6.22

32a and 32b are functionally equivalent variants of CRC32 where the crc
is a plain uint32, not a struct with just one field. Same for 64a, 64b,
and 64, respectively.

The most important figure is, that at MaxSpeed (/O2) 2x32 is almost
twice as fast as CRC32 while only being marginally slower than CRC32.

In case anybody wants to repeat my tests or find any flaw therein, the
source is attached.

Servus
Manfred

Attachment Content-Type Size
crctest.tgz application/octet-stream 8.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Manfred Koizar 2005-05-18 12:35:51 Re: Bitmap scan cost model (was Re: bitmap scans, btree scans, and tid order)
Previous Message Kaare Rasmussen 2005-05-18 10:57:02 Ingres dump files to PostgreSQL