Introduce a streaming rendering API to support incremental output and reduce memory usage for large templates.
- Added
render_stream(...)API across the rendering pipeline:Template::render_streamEngine::render_streamRenderer::render_stream
- Introduced streaming execution entrypoint in
ExecutionPlan - Output can now be written incrementally to a custom sink (
write(std::string))
- Streaming rendering is implemented without breaking the existing execution model
ExecutionPlandelegates execution toRendererfor consistency- Classic rendering (
std::stringbuffer) remains unchanged and fully supported - Streaming path reuses the same execution logic to guarantee identical output
-
Added streaming benchmarks for all major rendering scenarios:
- plain text
- variables
- expressions
- conditionals
- loops
- includes
- engine (cached / non-cached)
-
Results show:
- near-zero overhead compared to classic rendering
- identical performance characteristics in most cases
- no regression introduced by streaming API
- Added streaming rendering tests:
- text rendering
- variable rendering
- HTML escaping
- conditionals and loops
- includes
- equivalence check between
renderandrender_stream
- Current implementation streams at the API level while internally using a buffer
- This ensures correctness and stability before introducing instruction-level streaming
- Future versions will:
- eliminate intermediate buffers
- enable true chunk-by-chunk rendering
- support real-time streaming (HTTP, WebSocket)
- Enables incremental rendering API
- Prepares the engine for real-time and large-scale rendering use cases
- Lays the foundation for true streaming execution in future versions
Make rendering truly compiled by eliminating runtime expression parsing.
V8 turns the execution plan into a real compiled runtime by removing expression reparsing during rendering.
Expressions are now compiled once and evaluated directly, unlocking major performance gains across the entire rendering pipeline.
- Compile expressions into instructions
VariableInstrnow stores compiled expressionsJumpIfFalseInstruses compiled conditions
- Remove runtime expression parsing
- no more Lexer/Parser during render
- direct evaluation from execution plan
- Improve execution plan efficiency
- fully compiled rendering path
- better CPU cache locality
- Variable rendering: ~2.5x faster
- Expression rendering: ~4x faster
- Conditional rendering (
if): ~4x faster - Loops: ~2x faster
- Mixed templates: ~2x faster
- Engine cached templates: ~3–4x faster
Rendering performance now exceeds V6 across most scenarios.
- Remove
evaluate_compiled_expression(std::string, ...) - Use
evaluate_expression(Expression, ...)directly - Avoid temporary parsing structures during execution
- Optimize
render_template_by_name():- reduce allocations
- avoid unnecessary
RenderResultcopies - use
execute_plan()directly on fast path
- Add deep cloning of expression AST
- Store compiled expressions inside execution plan
- Remove
expression_to_string()path
- Core rendering path is now significantly faster than V6
- Include and template composition still remain the main bottleneck
- Cache lookup remains sub-microsecond
V6 introduced execution plans. V7 introduced correctness (cache + inheritance).
V8 completes the model:
- no runtime parsing
- true compiled execution
- predictable performance
This version marks the transition from a partially compiled engine to a fully compiled template runtime.
- Optimize include and template composition
- Reduce loader and cache overhead
- Further improve inheritance execution path
Add cache-aware template freshness and safer inheritance rendering.
V7 improves the template engine with cache freshness validation and a more robust rendering path for inheritance and block overrides.
- Add source signature support to
Template- freshness token for cache validation
- enables safe invalidation of stale compiled templates
- Improve cache integration
- validate compiled templates before reuse
- Improve inheritance rendering
- better handling of
extends - correct propagation of block overrides
- better handling of
- Keep AST alongside execution plan
- execution plan = fast path
- AST = inheritance, debugging, future compiler passes
Templateis now move-only- copy disabled
- move enabled
- Add
source_signature()andset_source_signature() - Refine renderer logic for parent-child templates
- Cache lookup faster than V6
- Slight overhead on rendering paths (~10-13%)
- Include and inheritance paths heavier due to correctness improvements
Compiler optimization with execution plan.
- Introduce execution plan
- precomputed rendering instructions
- avoids AST traversal during render
- Add optimized renderer
- instruction-based execution instead of recursive AST walk
- Improve rendering performance
- faster execution
- reduced CPU usage
- Separate parsing and execution phases
- Add
ExecutionPlan - Renderer supports plan-based execution
- major performance improvement
- foundation for further optimizations
Add full expression system.
- Support expressions in templates
{{ user.name }}{{ price * quantity }}{{ a == b }}
- Add expression AST
- Add operator parsing
- Add evaluation engine
- more flexible templates
- closer to full template engines
Add layout inheritance support.
- Support
{% extends %} - Support
{% block %} - Template inheritance system
- Parent-child template rendering
- reusable layouts
- modular templates
Add include support.
- Support
{% include %} - Template loader integration
- Dynamic template composition
- modular template structure
- reuse smaller components
Add filters support.
- Support filters on variables
{{ name | upper }}
- Filter system integration
- Extend rendering pipeline
Release improvements.
- Improve project structure
- Clean examples and templates
- Improve stability
Documentation improvements.
- Improve documentation
- Improve onboarding
- Add clearer examples
Stabilization release.
- Improve core engine reliability
- Refine API
- Prepare for advanced features (filters, include)
Fix cache handling for Template.
- Avoid copying non-copyable
Template - Fix ownership issues in cache layer
Initial template engine.
- AST-based template engine
- Parser and lexer
- Renderer
- Engine API
- Context system
- Basic template features
- Tests and examples
- Benchmarks
- fully functional template engine
- solid foundation for future versions
- Project initialization
- Repository setup