[PEAK] Regular functions vs generic functions

Phillip J. Eby pje at telecommunity.com
Fri Feb 15 13:36:01 EST 2008

At 11:54 AM 2/15/2008 -0500, rdmurray at bitdance.com wrote:
>So, I have rules in my code that look like this:
>     @analyze.when(matches("~NP A+~D"))
>which results in a rule like:
>     len(s)>=2 and (not s[0].isNP) and (s[1].isA and not s[1].isD)

Hm.  It's possible, then, that you have an exponential blowup 
somewhere, and/or the eagerness is killing you.  Currently, class 
tests are the only part of the dispatch tree that gets lazily 
expanded, so the code is probably building out the whole tree due to 
conditions like the above.

In a worst-case scenario, a tree like this can take 2^N time and 
space to build.  But I'll have to look at the full ruleset to see if 
that's actually the case.

More information about the PEAK mailing list