1
0
Fork 0
hugo/resources/page
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
..
page_generate all: Rework page store, add a dynacache, improve partial rebuilds, and some general spring cleaning 2024-01-27 16:28:14 +01:00
pagemeta all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
siteidentities all: Rework page store, add a dynacache, improve partial rebuilds, and some general spring cleaning 2024-01-27 16:28:14 +01:00
page.go tpl: Add a partial lookup cache 2025-04-10 11:07:19 +02:00
page_author.go hugolib: Deprecate site methods Author, Authors, and Social 2024-03-15 17:26:45 +01:00
page_data.go all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
page_data_test.go all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
page_integration_test.go testing: Simplify some integration tests 2024-01-28 22:17:22 +01:00
page_kinds.go Move all Kind constants to its own package 2023-07-28 15:14:23 +02:00
page_lazy_contentprovider.go Add Page.Contents with scope support 2024-08-29 16:45:21 +02:00
page_markup.go Don't count HTML markup in auto summaries 2024-09-10 11:03:47 +02:00
page_markup_integration_test.go Fix some RenderShortcodes error cases 2024-11-03 13:33:31 +01:00
page_markup_test.go Don't count HTML markup in auto summaries 2024-09-10 11:03:47 +02:00
page_marshaljson.autogen.go Run mage generate 2024-05-02 10:49:09 +02:00
page_matcher.go all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
page_matcher_test.go Make cascade front matter order deterministic 2025-01-23 09:45:47 +01:00
page_nop.go Add ContentTypes to config 2025-02-08 10:31:15 +01:00
page_outputformat.go Fix surprise OutputFormat.Rel overwriting 2022-01-04 10:38:38 +01:00
page_paths.go Reimplement and simplify Hugo's template system 2025-04-06 20:59:41 +02:00
page_wrappers.autogen.go Remove some old and unused deprecation code 2023-11-01 16:40:26 +01:00
pagegroup.go resources/page: Let GroupByParam return nil instead of error 2024-06-08 18:35:14 +02:00
pagegroup_test.go revamp pagegroup tests with quicktest 2024-08-02 10:03:20 +02:00
pages.go all: Rework page store, add a dynacache, improve partial rebuilds, and some general spring cleaning 2024-01-27 16:28:14 +01:00
pages_cache.go all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
pages_cache_test.go all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
pages_language_merge.go Create a struct with all of Hugo's config options 2023-05-16 18:01:29 +02:00
pages_prev_next.go Correct typos in Go comments 2023-03-02 16:32:32 +01:00
pages_prev_next_integration_test.go Add config options page.nextPrevSortOrder/nextPrevInSectionSortOrder 2024-08-17 16:47:50 +02:00
pages_prev_next_test.go all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
pages_related.go tpl: Add a partial lookup cache 2025-04-10 11:07:19 +02:00
pages_related_test.go Add page fragments support to Related 2023-02-21 17:56:41 +01:00
pages_sort.go Use the page path and not the backing filename as the last resort in the default sort 2025-02-26 13:06:26 +01:00
pages_sort_search.go resources/page: Fix GoDoc comment 2024-03-22 08:56:10 +01:00
pages_sort_search_test.go all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
pages_sort_test.go all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
pages_test.go all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
pagination.go resources/page: Deprecate PageSize in favor of PagerSize 2024-06-09 12:28:24 +02:00
pagination_test.go all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
path_integration_test.go resources/page: Escape hash sign in permalinks 2024-04-05 15:57:02 +02:00
permalinks.go resources/page: Revise the new contentbasename permalinks tokens 2025-02-17 09:41:49 +01:00
permalinks_integration_test.go resources/page: Revise the new contentbasename permalinks tokens 2025-02-17 09:41:49 +01:00
permalinks_test.go resources/page: Revise the new contentbasename permalinks tokens 2025-02-17 09:41:49 +01:00
site.go all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
site_integration_test.go resources/page: Deprecate .Sites.First in favor of .Sites.Default 2024-06-01 18:02:19 +02:00
taxonomy.go resources/page: Add taxonomies Page method 2024-04-12 16:26:02 +02:00
taxonomy_integration_test.go resources/page: Add taxonomies Page method 2024-04-12 16:26:02 +02:00
testhelpers_test.go Reimplement and simplify Hugo's template system 2025-04-06 20:59:41 +02:00
weighted.go Some godoc adjustments and image struct renames 2022-04-27 23:53:56 +02:00
zero_file.autogen.go all: Rework page store, add a dynacache, improve partial rebuilds, and some general spring cleaning 2024-01-27 16:28:14 +01:00