"Gurjeet Singh" <[EMAIL PROTECTED]> writes: > On 10/23/06, Tom Lane <[EMAIL PROTECTED] > 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 ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend