summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Peveler <matt.peveler@gmail.com>2020-06-02 04:42:43 +0300
committerGitHub <noreply@github.com>2020-06-01 21:42:43 -0400
commit07fa7df5268eb369b7f72e0ff506b6d43218e9a8 (patch)
tree0b3d132f3335c355a2d422163061f908b9a9526a
parentde24308c51c963155242837c4faab9169c087f6f (diff)
downloadasciidoc-py3-07fa7df5268eb369b7f72e0ff506b6d43218e9a8.tar.gz
use lru_cache for macros.match (#121)
Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
-rwxr-xr-xasciidoc.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/asciidoc.py b/asciidoc.py
index 1cac97f..f5c04cf 100755
--- a/asciidoc.py
+++ b/asciidoc.py
@@ -10,6 +10,7 @@ under the terms of the GNU General Public License (GPL).
import ast
import copy
import csv
+from functools import lru_cache
import getopt
import io
import locale
@@ -3937,6 +3938,7 @@ class Macros:
return m
return False
+ @lru_cache(maxsize=2048)
def match(self, prefix, name, text):
"""Return re match object matching 'text' with macro type 'prefix',
macro name 'name'."""