Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0c5af0a

Browse files
committed
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...
1 parent 6c878ed commit 0c5af0a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/commands/vacuumlazy.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1754,6 +1754,7 @@ static bool
17541754
heap_page_is_all_visible(Relation rel, Buffer buf, TransactionId *visibility_cutoff_xid)
17551755
{
17561756
Page page = BufferGetPage(buf);
1757+
BlockNumber blockno = BufferGetBlockNumber(buf);
17571758
OffsetNumber offnum,
17581759
maxoff;
17591760
bool all_visible = true;
@@ -1778,7 +1779,7 @@ heap_page_is_all_visible(Relation rel, Buffer buf, TransactionId *visibility_cut
17781779
if (!ItemIdIsUsed(itemid) || ItemIdIsRedirected(itemid))
17791780
continue;
17801781

1781-
ItemPointerSet(&(tuple.t_self), BufferGetBlockNumber(buf), offnum);
1782+
ItemPointerSet(&(tuple.t_self), blockno, offnum);
17821783

17831784
/*
17841785
* Dead line pointers can have index pointers pointing to them. So

0 commit comments

Comments
 (0)