Re: Cost of XLogInsert CRC calculations - Mailing list pgsql-hackers

From Mark Cave-Ayland
Subject Re: Cost of XLogInsert CRC calculations
Date
Msg-id 9EB50F1A91413F4FA63019487FCD251D113332@WEBBASEDDC.webbasedltd.local
Whole thread Raw
In response to Re: Cost of XLogInsert CRC calculations  ("Mark Cave-Ayland" <m.cave-ayland@webbased.co.uk>)
Responses Re: Cost of XLogInsert CRC calculations
Re: Cost of XLogInsert CRC calculations
Re: Cost of XLogInsert CRC calculations
List pgsql-hackers
> -----Original Message-----
> From: Mark Cave-Ayland [mailto:m.cave-ayland@webbased.co.uk] 
> Sent: 16 May 2005 09:04
> To: 'Simon Riggs'
> Cc: 'Christopher Kings-Lynne'; 'Tom Lane'; 'Bruce Momjian'; 
> 'pgsql-hackers@postgresql.org'
> Subject: RE: [HACKERS] Cost of XLogInsert CRC calculations

(cut)

> The program used to time the CRC64 calculation simply did the 
> following:

(cut)

>     2) Fill the buffer with some repeatable values; in this case the
>     algorithm used was the following:
> 
>         for (i = 0 ; i < 8192 ; i++ )
>         {
>             *data = (char )(i % 256);
>         }

Sigh, so it would help if I had added the offset to the data pointer... ;)
    for (i = 0 ; i < 8192 ; i++ )        {            *(data + i) = (char )(i % 256);        }

This now gives the following (correct) result on both platforms:Win32: 1.8GHz P4, WinXPLinux: 2.8GHz Xeon, FC1

Win32 UINT64:    0x782104059a01660    (crc0)
~158usWin32 UINT32:    0x78210405 (crc1), 0x59a01660 (crc0)    ~58us
FC1 UINT64:        0x782104059a01660 (crc0)
~76usFC1 UINT32:        0x78210405 (crc1), 0x59a01660 (crc0)
~29us


Note that we still find that using the INT64_IS_BUSTED code is over 100%
quicker than the UINT64 code for CRC64 calculation, and I believe it is not
being used by default under Linux or Win32 for 32 bit platforms. Of course
Tom's suggestion of going for CRC32 across the board would hopefully solve
this entirely and bring the times down a little further too.


Kind regards,

Mark.

------------------------
WebBased Ltd
17 Research Way
Plymouth
PL6 8BT 

T: +44 (0)1752 797131
F: +44 (0)1752 791023
W: http://www.webbased.co.uk




pgsql-hackers by date:

Previous
From: Dmitriy Letuchy
Date:
Subject: postgreSQL as deductive DBMS
Next
From: Dennis Bjorklund
Date:
Subject: SO_KEEPALIVE