> -----Original Message-----
> From: Mark Cave-Ayland [mailto:[EMAIL PROTECTED] 
> 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, WinXP
        Linux: 2.8GHz Xeon, FC1


        Win32 UINT64:   0x782104059a01660       (crc0)
~158us
        Win32 UINT32:   0x78210405 (crc1), 0x59a01660 (crc0)    ~58us

        FC1 UINT64:             0x782104059a01660 (crc0)
~76us
        FC1 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



---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to