Hugo is fast, but inefficient templates impede performance. Enable template metrics to determine which templates take the most time, and to identify caching opportunities:
: The cumulative time spent executing the template.
average duration
: The average time spent executing the template.
maximum duration
: The maximum time spent executing the template.
cache potential
: Displayed as a percentage, any partial template with a 100% cache potential should be called with the [`partialCached`] function instead of the [`partial`] function. See the [caching](#caching) section below.
percent cached
: The number of times the rendered templated was cached divided by the number of times the template was executed.
cached count
: The number of times the rendered templated was cached.
total count
: The number of times the template was executed.
template
: The path to the template, relative to the layouts directory.
Hugo builds pages in parallel where multiple pages are generated simultaneously. Because of this parallelism, the sum of "cumulative duration" values is usually greater than the actual time it takes to build a site.
{{% /note %}}
## Caching
Some partial templates such as sidebars or menus are executed many times during a site build. Depending on the content within the partial template and the desired output, the template may benefit from caching to reduce the number of executions. The [`partialCached`] template function provides caching capabilities for partial templates.
{{% note %}}
Note that you can create cached variants of each partial by passing additional parameters to `partialCached` beyond the initial context. See the `partialCached` documentation for more details.
{{% /note %}}
## Timers
Use the `debug.Timer` function to determine execution time for a block of code, useful for finding performance bottle necks in templates. See [details](/functions/debug/timer/).