author | Alberto Bertogli
<albertito@blitiri.com.ar> 2022-08-20 22:40:32 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2022-08-20 22:40:32 UTC |
parent | 162db6602a5dbde94498b9eddeb4e1f3acb10f73 |
blitiri.cgi | +4 | -2 |
diff --git a/blitiri.cgi b/blitiri.cgi index 3c2cf52..7c01da1 100755 --- a/blitiri.cgi +++ b/blitiri.cgi @@ -95,8 +95,6 @@ import sys import time import urllib.request, urllib.parse, urllib.error import zlib -from docutils.core import publish_parts -from docutils.utils import SystemMessage # Before importing the config, add our cwd to the Python path sys.path.append(os.getcwd()) @@ -523,6 +521,8 @@ def cached(f): # helper functions @cached def rst_to_html(rst, secure=True): + # Moving these here speeds up execution significantly on cache hit. + from docutils.core import publish_parts settings = { "input_encoding": encoding, "output_encoding": "utf8", @@ -536,6 +536,8 @@ def rst_to_html(rst, secure=True): def validate_rst(rst, secure=True): + # Moving these here speeds up execution significantly on cache hit. + from docutils.utils import SystemMessage try: rst_to_html(rst, secure) return None