This release will be the foundation for PHP Handlebars 1.0.
Changed
- Optimized position tracking to avoid per-token full-text rescans.
- Made use of the
preg_match()offset parameter and\Ganchor to avoid per-token string allocations. - Combined alternation pattern per state: replaced N separate
preg_match()calls (one per rule) with a single call against a per-state/\G(?:(rule0)|(rule1)|...)/pattern, letting PCRE try all alternatives in one pass.
Added
- Benchmark to test parsing a large, complex template 1000 times.
In this release, parsing a complex, 13 KB Handlebars template is now about 30x faster than in v1.0.0.