mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 19:36:43 +00:00
a60a522105
This PR was merged into the 1.17-dev branch.
Discussion
----------
added a profiler
This profiler allows to better understand what's going on when rendering templates. It should be used when debug is true only as it adds some overhead.
Here is a sample output in the text format:
```
main 567.04ms/100%
└ index 463.28ms/82%
└ base 463.24ms/82%
└ base::block(header)
└ index::block(content) 306.29ms/54%
│ └ included 50.18ms/9%
│ └ included 45.42ms/8%
│ └ included 35.42ms/6%
│ └ base::block(content) 104.97ms/19%
│ │ └ included 34.90ms/6%
│ └ included 35.84ms/6%
└ base::block(footer) 156.84ms/28%
└ included 38.96ms/7%
└ base::macro(foo)
```
You can also dump a profile in a Blackfire compatible format to [visualise the data as a graph](http://goo.gl/RwNGFH).
A profile is also a great way to be able to list all templates/blocks/macros that were used when rendering a template.
A PR on Symfony (symfony/symfony#13428) integrates this profiler in the Symfony web profiler to replace the current TimedTwigEngine and to add a new Twig panel.

Commits
-------
4408caa added a profiler