From: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | vadim(at)krs(dot)ru (Vadim Mikheev) |
Cc: | hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] sbufdesc' padding... |
Date: | 1998-12-02 01:26:34 |
Message-ID: | 199812020126.UAA08449@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> I'm going to remove subj...
>
> buf_internals.h:
>
> /*
> * I padded this structure to a power of 2 (PADDED_SBUFDESC_SIZE)
> * because BufferDescriptorGetBuffer is called a billion times and it
> * does an C pointer subtraction (i.e., "x - y" -> array index of x
> * relative to y, which is calculated using division by struct size).
> ^^^^^^^^^^^^^^^^^^^^^^^^
> * Integer ".div" hits you for 35 cycles, as opposed to a 1-cycle
> * "sra" ... this hack cut 10% off of the time to create the Wisconsin
> * database! It eats up more shared memory, of course, but we're
> * (allegedly) going to make some of these types bigger soon anyway...
> * -pma 1/2/93
> */
>
> This is not true now:
>
> #define BufferDescriptorGetBuffer(bdesc) ((bdesc)->buf_id + 1)
>
> Comments ?...
>
> Vadim
>
>
You can remove the comment about size-of-2. It currently pads to a
fixed size of 128, because the old code didn't work. We now do:
/*
* please, don't take the sizeof() this member and use it for
* something important
*/
char sb_relname[NAMEDATALEN + /* name of reln */
PADDED_SBUFDESC_SIZE - sizeof(struct sbufdesc_unpadded)];
which is much stranger, but works 100% of the time.
--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 1998-12-02 01:28:48 | Re: PL/pgSQL on BSDI-3.1 |
Previous Message | Bruce Momjian | 1998-12-02 01:21:35 | Re: [HACKERS] DROPping tables with SERIALs |