hugofs: Make FileMeta a struct
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 13 Jul 2021 09:41:02 +0000 (11:41 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 15 Jul 2021 15:14:26 +0000 (17:14 +0200)
commit022c4795510306e08a4aba31504ca382d41c7fac
treed4c29f62038d0f336d90f32f46bc5b4f5c3ddc28
parentf27e542442d19436f1428cc22bb03aca398d37a7
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
44 files changed:
commands/hugo.go
commands/new.go
common/hugo/hugo.go
create/content.go
helpers/general.go
hugofs/decorators.go
hugofs/fileinfo.go
hugofs/fileinfo_test.go [new file with mode: 0644]
hugofs/filter_fs.go
hugofs/glob_test.go
hugofs/language_composite_fs.go
hugofs/nosymlink_fs.go
hugofs/rootmapping_fs.go
hugofs/rootmapping_fs_test.go
hugofs/slice_fs.go
hugofs/walk.go
hugofs/walk_test.go
hugolib/content_map.go
hugolib/content_map_page.go
hugolib/content_map_test.go
hugolib/filesystems/basefs.go
hugolib/hugo_modules_test.go
hugolib/hugo_sites.go
hugolib/hugo_sites_build.go
hugolib/page.go
hugolib/page__meta.go
hugolib/pagebundler_test.go
hugolib/pagecollections.go
hugolib/pages_capture.go
hugolib/pages_process.go
langs/i18n/translationProvider.go
modules/npm/package_builder.go
resources/image.go
resources/image_cache.go
resources/resource_factories/create/create.go
resources/resource_transformers/js/build.go
resources/resource_transformers/js/options.go
resources/resource_transformers/postcss/postcss.go
resources/resource_transformers/tocss/dartsass/transform.go
resources/resource_transformers/tocss/scss/tocss.go
source/fileInfo.go
source/filesystem.go
source/filesystem_test.go
tpl/tplimpl/template.go