]> git.maquefel.me Git - brevno-suite/hugo/commit
page: Add some concurrency to the building of the related page index
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 22 Feb 2023 17:37:46 +0000 (18:37 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 22 Feb 2023 19:37:41 +0000 (20:37 +0100)
commitfa2d7adf102d2dec9ebc52b5bc6b161bbb07b726
tree0aaf038ebe6b5399d9383b7c0a775113e2a28391
parent4346987faf6ca957a855c0bae2938da50c53bbf0
page: Add some concurrency to the building of the related page index

But only in the case where we know that we will need to access the Page fragments/tableofcontents.

In normal situations this will spread naturally across the CPU cores, but not in the situation where
`site.RegularPages.Related` gets called as part of e.g. the single template.

```bash
name            old time/op    new time/op    delta
RelatedSite-10    18.0ms ± 2%    11.9ms ± 1%  -34.17%  (p=0.029 n=4+4)

name            old alloc/op   new alloc/op   delta
RelatedSite-10    38.6MB ± 0%    38.6MB ± 0%     ~     (p=0.114 n=4+4)

name            old allocs/op  new allocs/op  delta
RelatedSite-10      117k ± 0%      117k ± 0%   +0.23%  (p=0.029 n=4+4)
```

See #10711
resources/page/pages_related.go