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

Commit5536822

Browse files
committed
Tweak the tree descent loop in fsm_search_avail to not look at the
right child if it doesn't need to. This saves some miniscule numberof cycles, but the ulterior motive is to avoid an optimization bugknown to exist in SCO's C compiler (and perhaps others?)
1 parent253fa73 commit5536822

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

‎src/backend/storage/freespace/fsmpage.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/freespace/fsmpage.c,v 1.2 2008/10/07 21:10:11 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/freespace/fsmpage.c,v 1.3 2008/12/10 17:11:18 tgl Exp $
1212
*
1313
* NOTES:
1414
*
@@ -243,17 +243,20 @@ fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext,
243243
*/
244244
while (nodeno<NonLeafNodesPerPage)
245245
{
246-
intleftnodeno=leftchild(nodeno);
247-
intrightnodeno=leftnodeno+1;
248-
boolleftok= (leftnodeno<NodesPerPage)&&
249-
(fsmpage->fp_nodes[leftnodeno] >=minvalue);
250-
boolrightok= (rightnodeno<NodesPerPage)&&
251-
(fsmpage->fp_nodes[rightnodeno] >=minvalue);
252-
253-
if (leftok)
254-
nodeno=leftnodeno;
255-
elseif (rightok)
256-
nodeno=rightnodeno;
246+
intchildnodeno=leftchild(nodeno);
247+
248+
if (childnodeno<NodesPerPage&&
249+
fsmpage->fp_nodes[childnodeno] >=minvalue)
250+
{
251+
nodeno=childnodeno;
252+
continue;
253+
}
254+
childnodeno++;/* point to right child */
255+
if (childnodeno<NodesPerPage&&
256+
fsmpage->fp_nodes[childnodeno] >=minvalue)
257+
{
258+
nodeno=childnodeno;
259+
}
257260
else
258261
{
259262
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp