Age | Commit message (Collapse) | Author |
|
And remove now unsued hashing funcs.
|
|
|
|
Note that this is backed by a LRU cache (which we soon shall see more usage of), so if you're a heavy user of cached partials it may be evicted and
refreshed if needed. But in most cases every partial is only invoked once.
This commit also adds a timeout (the global `timeout` config option) to make infinite recursion in partials
easier to reason about.
```
name old time/op new time/op delta
IncludeCached-10 8.92ms ± 0% 8.48ms ± 1% -4.87% (p=0.016 n=4+5)
name old alloc/op new alloc/op delta
IncludeCached-10 6.65MB ± 0% 5.17MB ± 0% -22.32% (p=0.002 n=6+6)
name old allocs/op new allocs/op delta
IncludeCached-10 117k ± 0% 71k ± 0% -39.44% (p=0.002 n=6+6)
```
Closes #4086
Updates #9588
|
|
Under certain conditions, `howSimilarString` could reach a divide-by-
zero situation which causes bogus values to print in the cache potential
column of the template hints output. This situation essentially causes
a `int(math.NaN())` value to be returned and hilarity ensues thereafter.
|
|
We cannot (also, it doesn't add any value) use that when the `clock` is set,
* To measure time (before that global is set)
* To compare file timestamps re cache eviction
Fixes #9868
|
|
Close #8787
|
|
Updates #9687
|
|
Track cached partial executions and display more useful info when
showing the hints output. Also group cache hints and counters together
to the right of the timing measurements.
Sample output:
cumulative average maximum cache percent cached total
duration duration duration potential cached count count template
---------- -------- -------- --------- ------- ------ ----- --------
2.6973ms 674.325µs 857.3µs 0 0 0 4 _internal/_default/rss.xml
2.6295ms 657.375µs 861.3µs 0 0 0 4 _default/single.html
1.2563ms 314.075µs 381.5µs 0 0 0 4 news/single.html
799.2µs 399.6µs 573.3µs 0 0 0 2 _internal/_default/sitemap.xml
667.3µs 66.73µs 238.6µs 84 0 0 10 partials/header.html
656.7µs 328.35µs 459.4µs 0 0 0 2 _default/list.html
479.7µs 47.97µs 158µs 92 0 0 10 partials/head.html
323.3µs 323.3µs 323.3µs 0 0 0 1 _internal/alias.html
200.7µs 200.7µs 200.7µs 0 0 0 1 _internal/_default/sitemapindex.xml
36.1µs 6.016µs 32.6µs 100 33 2 6 partials/footer.html
27.4µs 13.7µs 26.7µs 0 0 0 2 index.html
Fixes #8375
|
|
See https://github.com/mvdan/gofumpt
|
|
Also improve non-string comparisons.
Fixes #7048
|
|
|
|
Also add a test.
|
|
This commit adds support for return values in partials.
This means that you can now do this and similar:
{{ $v := add . 42 }}
{{ return $v }}
Partials without a `return` statement will be rendered as before.
This works for both `partial` and `partialCached`.
Fixes #5783
|
|
|
|
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".
|
|
Highest first.
|
|
|