Re: New CRC algorithm: Slicing by 8

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: New CRC algorithm: Slicing by 8
Дата
Msg-id 26972.1161750637@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: New CRC algorithm: Slicing by 8  ("Gurjeet Singh" <singh.gurjeet@gmail.com>)
Список pgsql-hackers
"Gurjeet Singh" <singh.gurjeet@gmail.com> writes:
> On 10/23/06, Tom Lane <tgl@sss.pgh.pa.us > wrote:
>> I didn't particularly trust the timing calculations in your benchmark
>> program,

>     Any particular reason? (why and what did you doubt in it?).

Well, the specific thing that set off my bogometer was

#define TV_DIFF_MILLI(tv1, tv2) ((tv2.tv_sec*1000+((tv2.tv_usec)/1000))-(tv1.tv_sec*1000+((tv1.tv_usec)/1000)))

which is going to have overflow problems on any platform where tv_sec
isn't a 64-bit type (which is still all of 'em AFAIK).  But more
generally, your test is timing a CRC across 100 4Kb segments, which
isn't representative of PG's usage of CRCs.  I don't think there are
any XLogWrite calls that have more than about 5 segments, and in most
cases those segments contain a few dozen bytes not a few K.  So you
need to be looking at much shorter loop runs.

The test case I proposed uses timing code that I trusted (borrowed from
long-established coding in postgres.c), and tests loop lengths that are
somewhat representative for PG, but it is still biased in favor of slice8
because it repeats the CRC calculations consecutively without any other
activity --- presumably this fact creates a bias for a method that needs
more L2 cache space over one that doesn't need so much.  I'd have tried
harder to make an unbiased test case if this version had showed slice8 as
competitive, but so far it seems that on a majority of current CPUs and
compilers it's not competitive.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Steve Atkins
Дата:
Сообщение: Re: [DOCS] Replication documentation addition
Следующее
От: Praveen Kumar N
Дата:
Сообщение: Reg external sorting alogrithm