You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #446 measured repeated Jinja capability detection and found that parsing dominates the cost: one explicit Lexer/Parser pass plus a second parse inside dinja Template construction, followed by four distinct render probes. The render probes cannot be collapsed because they exercise different payloads.
The redundant second parse cannot currently be removed without an upstream dinja API change; #351 tracks the broader private-source/upstream coupling. A bounded cache at the TemplateCaps.detect boundary would avoid both parses and all four renders when the same template is detected repeatedly.
Proposed work
Add a bounded LRU keyed by exact template source, with an explicit conservative capacity.
Context
PR #446 measured repeated Jinja capability detection and found that parsing dominates the cost: one explicit Lexer/Parser pass plus a second parse inside dinja Template construction, followed by four distinct render probes. The render probes cannot be collapsed because they exercise different payloads.
The redundant second parse cannot currently be removed without an upstream dinja API change; #351 tracks the broader private-source/upstream coupling. A bounded cache at the TemplateCaps.detect boundary would avoid both parses and all four renders when the same template is detected repeatedly.
Proposed work
Boundary
This is a non-blocking performance improvement discovered during #446. It is not a prerequisite for the diagnostics fix or the next release.