Back

flask #5896

Cache compiled templates in render_template_string

by OptifinerAI · Feb 06, 2026 at 18:58 UTC · scan-509951a61d1ee786

High Risk (60%)

Get this automatically on every PR

Install the Axiomo GitHub App to get Signals as check runs and PR comments on every pull request.

Install App

Risk Assessment

Risk level: High (60%)

Risk Drivers

  • new_contributor: First contribution from OptifinerAI
  • young_account: Account OptifinerAI is 14 days old
  • api_surface_change: API surface changed in 2 file(s)

Intent

4/4 criteria met

Cache compiled templates to improve performance of render_template_string and stream_template_string.

Acceptance Criteria

  • Cache compiled templates using LRU eviction.

    templating.py adds an OrderedDict for caching.

  • Configurable cache size with limits on template length.

    templating.py introduces configurable cache settings.

  • Performance improvement benchmark exists.

    PR includes a benchmark showing a 60% improvement.

  • Proper tests exist for caching behavior.

    test_templating.py adds tests related to caching.

Confidence: 95.0% Source: pr description AI: openai

Contributors

OptifinerAI PR Author 1 commit ? New Contributor
Account Age: 14 days
Prior PRs: 1

First-time contributor to this repository. Account created 14 days ago. unfamiliar with 2 files.

Evidence

Evidence Completeness: 0.0%
Missing: ci_passing, tests_passing, lint_passing, security_scan_clean, coverage_maintained, build_successful

Supply Chain

None Risk
Modifies dependencies
Modifies lockfile
Modifies CI config
Modifies build scripts

Focus Files

Review 1 high-priority file(s)

tests/test_templating.py +103

103 lines changed; Source code

high
src/flask/templating.py +46

Source code

medium

Triage

28

minutes to review

high

effort level

medium

staleness risk

Allocate focused review time

Recommendation

NEEDS DISCUSSION 12.0% readiness

Insufficient evidence (CI/tests) to evaluate

Next Steps

Question

Why is ci_passing missing? Consider adding this check.

Question

Why is tests_passing missing? Consider adding this check.

Nitpick

First contribution - consider welcoming and providing extra context