changeset 26059:8779ce81ea80

reachableroots: unroll loop that checks if one of parents is reachable The difference is small, but fewer loops should be better in general: revset #0: 0::tip 0) 0.001609 1) 0.001510 93%
author Yuya Nishihara <yuya@tcha.org>
date Sun, 16 Aug 2015 09:30:37 +0900
parents e7fe0a12376c
children 4ee2af2194d4
files mercurial/parsers.c
diffstat 1 files changed, 11 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/parsers.c	Sat Aug 15 19:38:03 2015 +0900
+++ b/mercurial/parsers.c	Sun Aug 16 09:30:37 2015 +0900
@@ -1240,18 +1240,17 @@
 			 * index_get_parents */
 			if (r < 0)
 				goto bail;
-			for (k = 0; k < 2; k++) {
-				if ((revstates[parents[k] + 1] & RS_REACHABLE)
-				    && !(revstates[i + 1] & RS_REACHABLE)) {
-					revstates[i + 1] |= RS_REACHABLE;
-					val = PyInt_FromLong(i);
-					if (val == NULL)
-						goto bail;
-					r = PyList_Append(reachable, val);
-					Py_DECREF(val);
-					if (r < 0)
-						goto bail;
-				}
+			if (((revstates[parents[0] + 1] |
+			      revstates[parents[1] + 1]) & RS_REACHABLE)
+			    && !(revstates[i + 1] & RS_REACHABLE)) {
+				revstates[i + 1] |= RS_REACHABLE;
+				val = PyInt_FromLong(i);
+				if (val == NULL)
+					goto bail;
+				r = PyList_Append(reachable, val);
+				Py_DECREF(val);
+				if (r < 0)
+					goto bail;
 			}
 		}
 	}