I have written a proposal for Go to implement the changes that Hugo recently added to a fork of Go’s template packages (mainly to avoid having to maintain this fork). I guess some “thumbs up” on that issue would not hurt:
Note that the above is already in Hugo. Interesting enough, this doesn’t just have functional upsides. I found a new bottle neck that I fixed with this yesterday. And a relevant benchmark comparing the current master source version with v0.61.0 shows great improvements:
name old time/op new time/op delta
SiteNew/Many_HTML_templates-16 55.6ms ± 2% 42.9ms ± 1% -22.81% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
SiteNew/Many_HTML_templates-16 22.5MB ± 0% 17.6MB ± 0% -21.99% (p=0.008 n=5+5)
name old allocs/op new allocs/op delta
SiteNew/Many_HTML_templates-16 341k ± 0% 247k ± 0% -27.48% (p=0.008 n=5+5)