shithub: mc

Download patch

ref: e31d035cf358e05158c0de708f31f9050043d997
parent: 4be51eb1ffb5b87d36a9910012bbc513d8a0bd2d
author: Ori Bernstein <[email protected]>
date: Tue Jan 7 17:51:23 EST 2014

Compress unification chains.

    This reduces the average chain length by a factor of 50 to
    100 in practice.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -312,6 +312,9 @@
 
         if (!tytab[t->tid])
             break;
+        /* compress paths: shift the link up one level */
+        if (tytab[tytab[t->tid]->tid])
+            tytab[t->tid] = tytab[tytab[t->tid]->tid];
         t = tytab[t->tid];
     }
     return t;