Move BufferGetBlockNumber() out of heap_page_is_all_visible()'s inner loop.

In some workloads BufferGetBlockNumber() shows up in profiles due to
the sheer number of calls to it (and because it causes cache
misses). The compiler can't move it out of the loop because it's a
full extern function call...
This commit is contained in:
Andres Freund 2014-11-14 17:04:44 +01:00
parent 6c878edc1d
commit 0c5af0a537
1 changed files with 2 additions and 1 deletions

View File

@ -1754,6 +1754,7 @@ static bool
heap_page_is_all_visible(Relation rel, Buffer buf, TransactionId *visibility_cutoff_xid)
{
Page page = BufferGetPage(buf);
BlockNumber blockno = BufferGetBlockNumber(buf);
OffsetNumber offnum,
maxoff;
bool all_visible = true;
@ -1778,7 +1779,7 @@ heap_page_is_all_visible(Relation rel, Buffer buf, TransactionId *visibility_cut
if (!ItemIdIsUsed(itemid) || ItemIdIsRedirected(itemid))
continue;
ItemPointerSet(&(tuple.t_self), BufferGetBlockNumber(buf), offnum);
ItemPointerSet(&(tuple.t_self), blockno, offnum);
/*
* Dead line pointers can have index pointers pointing to them. So