Cache compiled templates in render_template_string
by OptifinerAI
·
Feb 06, 2026 at 18:58 UTC
·
scan-509951a61d1ee786
Get this automatically on every PR
Install the Axiomo GitHub App to get Signals as check runs and PR comments on every pull request.
Risk level: High (60%)
Cache compiled templates to improve performance of render_template_string and stream_template_string.
templating.py adds an OrderedDict for caching.
templating.py introduces configurable cache settings.
PR includes a benchmark showing a 60% improvement.
test_templating.py adds tests related to caching.
First-time contributor to this repository. Account created 14 days ago. unfamiliar with 2 files.
Review 1 high-priority file(s)
tests/test_templating.py
+103
103 lines changed; Source code
src/flask/templating.py
+46
Source code
28
minutes to review
high
effort level
medium
staleness risk
Allocate focused review time
Insufficient evidence (CI/tests) to evaluate
Why is ci_passing missing? Consider adding this check.
Why is tests_passing missing? Consider adding this check.
First contribution - consider welcoming and providing extra context