hugo/common
Bjørn Erik Pedersen 208a0de6c3 tpl: Add a partial lookup cache
````
                 │ stash.bench  │          perf-v146.bench           │
                 │    sec/op    │   sec/op     vs base               │
LookupPartial-10   248.00n ± 0%   14.75n ± 2%  -94.05% (p=0.002 n=6)

                 │ stash.bench │          perf-v146.bench          │
                 │    B/op     │   B/op     vs base                │
LookupPartial-10    48.00 ± 0%   0.00 ± 0%  -100.00% (p=0.002 n=6)

                 │ stash.bench │          perf-v146.bench           │
                 │  allocs/op  │ allocs/op   vs base                │
LookupPartial-10    3.000 ± 0%   0.000 ± 0%  -100.00% (p=0.002 n=6)
```

THe speedup above assumes reuse of the same partials over and over again, which I think is not uncommon.

This commits also adds some more lookup benchmarks. The current output of these on my MacBook looks decent:

```
BenchmarkLookupPagesLayout/Single_root-10                3031562               395.5 ns/op             0 B/op          0 allocs/op
BenchmarkLookupPagesLayout/Single_sub_folder-10          2515915               480.9 ns/op             0 B/op          0 allocs/op
BenchmarkLookupPartial-10                               84808112                14.13 ns/op            0 B/op          0 allocs/op
BenchmarkLookupShortcode/toplevelpage-10                 8111779               148.2 ns/op             0 B/op          0 allocs/op
BenchmarkLookupShortcode/nestedpage-10                   8088183               148.6 ns/op             0 B/op          0 allocs/op
```

Note that in the above the partial lookups are cahced, the others not (they are harder to cache because of the page path).

Closes #13571
2025-04-10 11:07:19 +02:00
..
collections all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
constants Reimplement and simplify Hugo's template system 2025-04-06 20:59:41 +02:00
hashing all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
hcontext all: Rework page store, add a dynacache, improve partial rebuilds, and some general spring cleaning 2024-01-27 16:28:14 +01:00
herrors all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
hexec common/hexec: Remove github.com/cli/safeexec 2025-03-23 13:55:42 +01:00
hreflect common/hreflect: Replace the map/RWMutex method cache with sync.Map 2025-03-26 14:24:51 +01:00
hstrings Reimplement and simplify Hugo's template system 2025-04-06 20:59:41 +02:00
htime all: Run gofumpt -l -w . 2024-01-28 23:14:09 +01:00
hugio all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
hugo tpl: Add templates.Current 2025-04-09 20:15:40 +02:00
loggers all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
maps tpl: Add a partial lookup cache 2025-04-10 11:07:19 +02:00
math Preserve input type. 2024-11-14 15:05:37 +01:00
para all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
paths Reimplement and simplify Hugo's template system 2025-04-06 20:59:41 +02:00
predicate Add a HTTP cache for remote resources. 2024-06-04 16:07:39 +02:00
rungroup all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
tasks all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
terminal all: Rework page store, add a dynacache, improve partial rebuilds, and some general spring cleaning 2024-01-27 16:28:14 +01:00
text all: Run gofumpt -l -w . 2024-01-28 23:14:09 +01:00
types Reimplement and simplify Hugo's template system 2025-04-06 20:59:41 +02:00
urls all: Rework page store, add a dynacache, improve partial rebuilds, and some general spring cleaning 2024-01-27 16:28:14 +01:00
docs.go Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00