mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-16 20:53:59 +02:00
Improve rendering time
50% speedup. Fix #91 to run the benchmark: go test -test.run=NONE -bench=".*" -test.benchmem=true ./transform/ > new.txt to compare the results: /usr/local/go/misc/benchcmp baseline.txt new.txt Speedup and memory improvements benchmark old ns/op new ns/op delta BenchmarkChain 101219 50453 -50.15% BenchmarkTransform 51625 45531 -11.80% benchmark old allocs new allocs delta BenchmarkChain 222 103 -53.60% BenchmarkTransform 135 106 -21.48% benchmark old bytes new bytes delta BenchmarkChain 23919 10998 -54.02% BenchmarkTransform 11858 10665 -10.06%
This commit is contained in:
@@ -64,7 +64,6 @@ type Site struct {
|
||||
Info SiteInfo
|
||||
Shortcodes map[string]ShortcodeFunc
|
||||
timer *nitro.B
|
||||
Transformer transform.Transformer
|
||||
Target target.Output
|
||||
Alias target.AliasPublisher
|
||||
Completed chan bool
|
||||
@@ -581,9 +580,14 @@ func (s *Site) render(d interface{}, out string, layouts ...string) (err error)
|
||||
section, _ = page.RelPermalink()
|
||||
}
|
||||
|
||||
|
||||
absURL, err := transform.AbsURL(s.Config.BaseUrl)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
transformer := transform.NewChain(
|
||||
&transform.AbsURL{BaseURL: s.Config.BaseUrl},
|
||||
&transform.NavActive{Section: section},
|
||||
append(absURL, transform.NavActive(section, "hugo-nav")...)...
|
||||
)
|
||||
|
||||
renderReader, renderWriter := io.Pipe()
|
||||
|
Reference in New Issue
Block a user