mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
hugofs: Make FileMeta a struct
This commit started out investigating a `concurrent map read write` issue, ending by replacing the map with a struct. This is easier to reason about, and it's more effective: ``` name old time/op new time/op delta SiteNew/Regular_Deep_content_tree-16 71.5ms ± 3% 69.4ms ± 5% ~ (p=0.200 n=4+4) name old alloc/op new alloc/op delta SiteNew/Regular_Deep_content_tree-16 29.7MB ± 0% 27.9MB ± 0% -5.82% (p=0.029 n=4+4) name old allocs/op new allocs/op delta SiteNew/Regular_Deep_content_tree-16 313k ± 0% 303k ± 0% -3.35% (p=0.029 n=4+4) ``` See #8749
This commit is contained in:
@@ -89,7 +89,7 @@ func (proc *pagesProcessor) Wait() error {
|
||||
}
|
||||
|
||||
func (proc *pagesProcessor) getProcFromFi(fi hugofs.FileMetaInfo) pagesCollectorProcessorProvider {
|
||||
if p, found := proc.procs[fi.Meta().Lang()]; found {
|
||||
if p, found := proc.procs[fi.Meta().Lang]; found {
|
||||
return p
|
||||
}
|
||||
return defaultPageProcessor
|
||||
@@ -151,7 +151,7 @@ func (p *sitePagesProcessor) copyFile(fim hugofs.FileMetaInfo) error {
|
||||
|
||||
s := p.m.s
|
||||
|
||||
target := filepath.Join(s.PathSpec.GetTargetLanguageBasePath(), meta.Path())
|
||||
target := filepath.Join(s.PathSpec.GetTargetLanguageBasePath(), meta.Path)
|
||||
|
||||
defer f.Close()
|
||||
|
||||
@@ -171,7 +171,7 @@ func (p *sitePagesProcessor) doProcess(item interface{}) error {
|
||||
}
|
||||
meta := v.Meta()
|
||||
|
||||
classifier := meta.Classifier()
|
||||
classifier := meta.Classifier
|
||||
switch classifier {
|
||||
case files.ContentClassContent:
|
||||
if err := m.AddFilesBundle(v); err != nil {
|
||||
@@ -192,5 +192,5 @@ func (p *sitePagesProcessor) doProcess(item interface{}) error {
|
||||
|
||||
func (p *sitePagesProcessor) shouldSkip(fim hugofs.FileMetaInfo) bool {
|
||||
// TODO(ep) unify
|
||||
return p.m.s.SourceSpec.DisabledLanguages[fim.Meta().Lang()]
|
||||
return p.m.s.SourceSpec.DisabledLanguages[fim.Meta().Lang]
|
||||
}
|
||||
|
Reference in New Issue
Block a user