Compare commits

...

2 Commits

Author SHA1 Message Date
Nathaniel May
78d2a92f84 commenting out performance optimization to test it 2021-02-16 19:09:58 -05:00
Nathaniel May
93df8b95d5 adding comment to verify optimizaion. 2021-02-15 19:05:13 -05:00

View File

@@ -550,7 +550,7 @@ def _requote_result(raw_value: str, rendered: str) -> str:
# checking two separate patterns, but the standard deviation is smaller with
# one pattern. The time difference between the two was ~2 std deviations, which
# is small enough that I've just chosen the more readable option.
_HAS_RENDER_CHARS_PAT = re.compile(r'({[{%#]|[#}%]})')
# _HAS_RENDER_CHARS_PAT = re.compile(r'({[{%#]|[#}%]})')
def get_rendered(
@@ -566,12 +566,14 @@ def get_rendered(
# If this is desirable in the native env as well, we could handle the
# native=True case by passing the input string to ast.literal_eval, like
# the native renderer does.
if (
not native and
isinstance(string, str) and
_HAS_RENDER_CHARS_PAT.search(string) is None
):
return string
#
# this optimization has been benchmarked and is worth it.
# if (
# not native and
# isinstance(string, str) and
# _HAS_RENDER_CHARS_PAT.search(string) is None
# ):
# return string
template = get_template(
string,
ctx,