|
From: <sv...@va...> - 2007-10-06 14:34:48
|
Author: sewardj
Date: 2007-10-06 15:34:45 +0100 (Sat, 06 Oct 2007)
New Revision: 6960
Log:
Speed up nextIterFM by avoiding at least half of the pushes/pops,
by partially evaluating the forwards paths from case 1: and case: 3.
Modified:
branches/THRCHECK/thrcheck/tc_wordfm.c
Modified: branches/THRCHECK/thrcheck/tc_wordfm.c
===================================================================
--- branches/THRCHECK/thrcheck/tc_wordfm.c 2007-10-06 11:49:11 UTC (rev 6959)
+++ branches/THRCHECK/thrcheck/tc_wordfm.c 2007-10-06 14:34:45 UTC (rev 6960)
@@ -632,9 +632,10 @@
// keeping this loop in this simpler form.
while (stackPop(fm, &n, &i)) {
switch (i) {
- case 1:
+ case 1: case_1:
stackPush(fm, n, 2);
- if (n->child[0]) stackPush(fm, n->child[0], 1);
+ /* if (n->child[0]) stackPush(fm, n->child[0], 1); */
+ if (n->child[0]) { n = n->child[0]; goto case_1; }
break;
case 2:
stackPush(fm, n, 3);
@@ -642,7 +643,8 @@
if (pVal) *pVal = n->val;
return True;
case 3:
- if (n->child[1]) stackPush(fm, n->child[1], 1);
+ /* if (n->child[1]) stackPush(fm, n->child[1], 1); */
+ if (n->child[1]) { n = n->child[1]; goto case_1; }
break;
default:
tl_assert(0);
|