From 4c86e2fe867c3bcf3be7271ef4dc405e24d3a296 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Thu, 29 Dec 2011 11:01:21 -0600 Subject: [PATCH] redex: memoize only the non-terminal patterns remarkably, this seems to cut the time for running the r6rs test suite in about 1/2 --- collects/redex/private/matcher.rkt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/collects/redex/private/matcher.rkt b/collects/redex/private/matcher.rkt index 8994307ab5..4c0a2876bd 100644 --- a/collects/redex/private/matcher.rkt +++ b/collects/redex/private/matcher.rkt @@ -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)))]