mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
hugolib: Add a cache to GetPage
Looks to be slightly slower with the low number of section pages, but the 1000 regular pages seem to add value. ``` benchmark old ns/op new ns/op delta BenchmarkGetPage-4 97.7 145 +48.41% BenchmarkGetPageRegular-4 7933 161 -97.97% benchmark old allocs new allocs delta BenchmarkGetPage-4 0 0 +0.00% BenchmarkGetPageRegular-4 0 0 +0.00% benchmark old bytes new bytes delta BenchmarkGetPage-4 0 0 +0.00% BenchmarkGetPageRegular-4 0 0 +0.00% ```
This commit is contained in:
@@ -42,8 +42,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
cjk = regexp.MustCompile(`\p{Han}|\p{Hangul}|\p{Hiragana}|\p{Katakana}`)
|
||||
allKinds = []string{KindPage, KindHome, KindSection, KindTaxonomy, KindTaxonomyTerm, kindRSS, kindSitemap, kindRobotsTXT, kind404}
|
||||
cjk = regexp.MustCompile(`\p{Han}|\p{Hangul}|\p{Hiragana}|\p{Katakana}`)
|
||||
allKindsInPages = []string{KindPage, KindHome, KindSection, KindTaxonomy, KindTaxonomyTerm, kindRSS}
|
||||
allKinds = append(allKindsInPages, []string{kindSitemap, kindRobotsTXT, kind404}...)
|
||||
)
|
||||
|
||||
const (
|
||||
|
Reference in New Issue
Block a user