Commit graph

2 commits

Author SHA1 Message Date
semihalev
0f06dd0fd9 Update benchmark results with latest performance metrics
Latest benchmark runs show dramatic performance improvements:
- Twig is now 57x faster than Go's html/template for complex templates
- Memory usage reduced by 90% compared to standard Go templates
- Performance on medium templates improved to 0.14 µs/op from 0.35 µs/op
- Simple template rendering improved to 0.28 µs/op from 0.47 µs/op

These improvements reflect the optimizations from object pooling and
filter chain handling optimizations in recent commits.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-11 14:54:36 +03:00
semihalev
6fceb1c808 Implement comprehensive object and token pooling for zero memory footprint
This commit dramatically improves memory efficiency and performance by:

1. Adding object pooling for frequently allocated node types:
   - TextNode, PrintNode, RootNode, LiteralNode, VariableNode, IfNode, ForNode
   - Released nodes properly after rendering is complete

2. Implementing token pooling to reduce allocations during parsing:
   - Added token pool for all token creation sites
   - Optimized token slice allocation with capacity hints

3. Improved RenderContext and StringBuffer handling:
   - Better cleanup and resource management

Benchmark results show:
- 91% reduction in memory usage compared to Go's templates
- 60x performance improvement in rendering speed
- Consistently 2 allocations per operation for all node types

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-11 14:49:55 +03:00