redex: memoize only the non-terminal patterns

remarkably, this seems to cut the time for running
the r6rs test suite in about 1/2
This commit is contained in:
Robby Findler 2011-12-29 11:01:21 -06:00
parent 57f51cf5c8
commit 4c86e2fe86

View File

@ -686,7 +686,10 @@ See match-a-pattern.rkt for more details
[(eq? compiled-cache uniq)
(let-values ([(compiled-pattern has-hole?)
(true-compile-pattern pattern)])
(let ([val (list (memoize compiled-pattern has-hole?)
(let ([val (list (match pattern
[`(nt ,p)
(memoize compiled-pattern has-hole?)]
[_ compiled-pattern])
has-hole?)])
(hash-set! compiled-pattern-cache pattern val)
(apply values val)))]