Wouter De Jong Fabien Potencier
Contributed by Wouter De Jong and Fabien Potencier in #8719

Ever wanted to time parts of a template? The new Symfony 2.4 stopwatch tag allows you to time any part of a template. This information is then stored in the profiler and available in the "timeline" section of the web profiler:

1
2
3
{% stopwatch "foo" %}
    ... some things that gets timed
{% endstopwatch %}

You can also use the same name more than once in your project to group the times on the same line in the web profiler timeline.

The tag being part of the Twig bridge, you can also leverage it in your Silex applications.

Published in #Living on the edge