Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit03a42c9

Browse files
committed
Use pg_memory_is_all_zeros() in PageIsVerifiedExtended()
Relying on pg_memory_is_all_zeros(), which would apply SIMD instructionswhen dealing with an aligned page, is proving to be at least three timesfaster than the original size_t-based comparisons when checking if aBLCKSZ page is full of zeros. Note that PageIsVerifiedExtended() iscalled each time a page is read from disk, and making it faster is agood thing.Author: Bertrand DrouvotDiscussion:https://postgr.es/m/CAApHDvq7P-JgFhgtxUPqhavG-qSDVUhyWaEX9M8_MNorFEijZA@mail.gmail.com
1 parent5be1dab commit03a42c9

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

‎src/backend/storage/page/bufpage.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,8 @@ PageIsVerifiedExtended(Page page, BlockNumber blkno, int flags)
8989
{
9090
PageHeaderp= (PageHeader)page;
9191
size_t*pagebytes;
92-
inti;
9392
boolchecksum_failure= false;
9493
boolheader_sane= false;
95-
boolall_zeroes= false;
9694
uint16checksum=0;
9795

9896
/*
@@ -126,18 +124,9 @@ PageIsVerifiedExtended(Page page, BlockNumber blkno, int flags)
126124
}
127125

128126
/* Check all-zeroes case */
129-
all_zeroes= true;
130127
pagebytes= (size_t*)page;
131-
for (i=0;i< (BLCKSZ /sizeof(size_t));i++)
132-
{
133-
if (pagebytes[i]!=0)
134-
{
135-
all_zeroes= false;
136-
break;
137-
}
138-
}
139128

140-
if (all_zeroes)
129+
if (pg_memory_is_all_zeros(pagebytes,BLCKSZ))
141130
return true;
142131

143132
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp