Use pg_memory_is_all_zeros() in PageIsVerifiedExtended()
Relying on pg_memory_is_all_zeros(), which would apply SIMD instructions when dealing with an aligned page, is proving to be at least three times faster than the original size_t-based comparisons when checking if a BLCKSZ page is full of zeros. Note that PageIsVerifiedExtended() is called each time a page is read from disk, and making it faster is a good thing. Author: Bertrand Drouvot Discussion: https://postgr.es/m/CAApHDvq7P-JgFhgtxUPqhavG-qSDVUhyWaEX9M8_MNorFEijZA@mail.gmail.com
This commit is contained in:
parent
5be1dabd2a
commit
03a42c9652
@ -89,10 +89,8 @@ PageIsVerifiedExtended(Page page, BlockNumber blkno, int flags)
|
||||
{
|
||||
PageHeader p = (PageHeader) page;
|
||||
size_t *pagebytes;
|
||||
int i;
|
||||
bool checksum_failure = false;
|
||||
bool header_sane = false;
|
||||
bool all_zeroes = false;
|
||||
uint16 checksum = 0;
|
||||
|
||||
/*
|
||||
@ -126,18 +124,9 @@ PageIsVerifiedExtended(Page page, BlockNumber blkno, int flags)
|
||||
}
|
||||
|
||||
/* Check all-zeroes case */
|
||||
all_zeroes = true;
|
||||
pagebytes = (size_t *) page;
|
||||
for (i = 0; i < (BLCKSZ / sizeof(size_t)); i++)
|
||||
{
|
||||
if (pagebytes[i] != 0)
|
||||
{
|
||||
all_zeroes = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (all_zeroes)
|
||||
if (pg_memory_is_all_zeros(pagebytes, BLCKSZ))
|
||||
return true;
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user