From 89bd1e6abed71779a440b37df561b5307249ac2e Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Sun, 12 Jul 2020 03:50:32 -0700 Subject: [PATCH] only add new_children (marginally faster) --- masque/pattern.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/masque/pattern.py b/masque/pattern.py index f254352..663b060 100644 --- a/masque/pattern.py +++ b/masque/pattern.py @@ -915,7 +915,7 @@ class Pattern: def get_children(pat: Pattern, memo: Set) -> Set: children = set(sp.pattern for sp in pat.subpatterns if sp.pattern is not None) new_children = children - memo - memo |= children + memo |= new_children for child_pat in new_children: memo |= get_children(child_pat, memo)