make BufferGetBlockNumber() a macro - Mailing list pgsql-patches

From Neil Conway
Subject make BufferGetBlockNumber() a macro
Date
Msg-id 20020401161353.6f33cfda.nconway@klamath.dyndns.org
Whole thread Raw
Responses Re: make BufferGetBlockNumber() a macro
List pgsql-patches
The attached patch re-implements BufferGetBlockNumber() as a macro,
for performance reasons. It also adds an assertion that should probably
be present.

I ran into this while profiling the hash index creation code (and
trying to determine why it's so slow). I noticed that this simple
function was being called about 2,500,000 times while creating a hash
index on a reasonably sized table (225,000 rows). By implementing this
as a macro, the performance of hash index creation improves by 8% (in
a totally unscientific and probably unreliable benchmark).

Cheers,

Neil

--
Neil Conway <neilconway@rogers.com>
PGP Key ID: DB3C29FC

Attachment

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: ALTER TABLE ... RENAME: minor stuff
Next
From: Tom Lane
Date:
Subject: Re: make BufferGetBlockNumber() a macro