metrics: Detect partialCached candidates
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 4 Oct 2017 20:12:51 +0000 (22:12 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 7 Oct 2017 16:00:07 +0000 (18:00 +0200)
commit5800a20a258378440e203a6c4a4343f5077755df
treedca1bd5030dccd56b4e9ad2dc1e037955aa4e20d
parente2e8bcbec34702a27047b91b6b007a15f1fc0797
metrics: Detect partialCached candidates

This commit adds a "cache potential" column when running `hugo --templateMetrics --templateMetricsHints`.

This is only calculated when `--templateMetricsHints` is set, as these calculations has an negative effect on the other timings.

This gives a value for partials only, and is a number between 0-100 that indicates if `partial` can be replaced with `partialCached`.

100 means that all execution of the same partial resulted in the same output.

You should do  some manual research before going "all cache".
commands/hugo.go
deps/deps.go
metrics/metrics.go
metrics/metrics_test.go [new file with mode: 0644]
tpl/partials/partials.go