diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-10-24 13:45:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-24 13:45:30 +0200 |
commit | a10b2cd372798c4e4b862f0ec03010d2aea2ff1e (patch) | |
tree | f768c420aac0008e4d118709e13fda278a7588c5 /tpl/template.go | |
parent | dffd7da07c3fb198acfa6c4664b53132c4cabe55 (diff) |
Avoid reading from Viper for path and URL funcs
The gain, given the "real sites benchmark" below, is obvious:
```
benchmark old ns/op new ns/op delta
BenchmarkHugo-4 14497594101 13084156335 -9.75%
benchmark old allocs new allocs delta
BenchmarkHugo-4 57404335 48282002 -15.89%
benchmark old bytes new bytes delta
BenchmarkHugo-4 9933505624 9721984424 -2.13%
```
Fixes #2495
Diffstat (limited to 'tpl/template.go')
-rw-r--r-- | tpl/template.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tpl/template.go b/tpl/template.go index 1fba368e4..fa358ca37 100644 --- a/tpl/template.go +++ b/tpl/template.go @@ -94,6 +94,10 @@ func New() Template { localTemplates = &templates.Template + // The URL funcs in the funcMap is somewhat language dependent, + // so need to be reinit per site. + initFuncMap() + for k, v := range funcMap { amber.FuncMap[k] = v } |