]> gitweb.factorcode.org Git - factor.git/commitdiff
xmode.marker: caching match group regexps for performance
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 9 Aug 2022 00:43:13 +0000 (17:43 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 9 Aug 2022 21:53:55 +0000 (14:53 -0700)
basis/xmode/marker/marker.factor

index 05e93b61548447f417e21c6a99e6a8d1837e2acf..4ecfa9b7963cd0fbde4d8e869d8d2e5398f48c73 100644 (file)
@@ -102,7 +102,7 @@ M: regexp text-matches?
 : match-group-regexp ( regexp n -- skip-regexp match-regexp )
     [ [ options>> options>string ] [ raw>> ] bi ] dip
     CHAR: ( pick nth-index cut CHAR: ) over index 1 + head
-    rot '[ _ <optioned-regexp> ] bi@ ;
+    rot '[ H{ } [ _ <optioned-regexp> ] cache ] bi@ ;
 
 : skip-first-match ( match regexp -- tailseq )
     first-match [ seq>> ] [ to>> ] bi tail ;