hugo/hugolib
Bjørn Erik Pedersen 4ef9baf5bd Only invoke a given cached partial once
Note that this is backed by a LRU cache (which we soon shall see more usage of), so if you're a heavy user of cached partials it may be evicted and
refreshed if needed. But in most cases every partial is only invoked once.

This commit also adds a timeout (the global `timeout` config option) to make infinite recursion in partials
easier to reason about.

```
name              old time/op    new time/op    delta
IncludeCached-10    8.92ms ± 0%    8.48ms ± 1%   -4.87%  (p=0.016 n=4+5)

name              old alloc/op   new alloc/op   delta
IncludeCached-10    6.65MB ± 0%    5.17MB ± 0%  -22.32%  (p=0.002 n=6+6)

name              old allocs/op  new allocs/op  delta
IncludeCached-10      117k ± 0%       71k ± 0%  -39.44%  (p=0.002 n=6+6)
```

Closes #4086
Updates #9588
2023-01-25 17:35:23 +01:00
..
assets/images Image resource refactor 2019-08-26 15:00:44 +02:00
filesystems Also consider wrapped errors when checking for file IsNotExist errors 2022-12-14 13:51:06 +01:00
paths Fix relURL with leading slash when baseURL includes a subdirectory 2022-06-13 11:40:25 +02:00
testdata Add some basic security policies with sensible defaults 2021-12-16 09:40:22 +01:00
testsite Add support for CODEOWNERS 2022-02-23 22:43:19 +01:00
404_test.go all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
alias.go tpl/fmt: Add erroridf template func 2021-06-07 19:11:03 +02:00
alias_test.go all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
breaking_changes_test.go all: Fix minor typos 2020-12-16 12:11:32 +01:00
cascade_test.go errors: Misc improvements 2022-05-14 13:40:56 +02:00
codeowners.go Also consider wrapped errors when checking for file IsNotExist errors 2022-12-14 13:51:06 +01:00
collections.go Some godoc adjustments and image struct renames 2022-04-27 23:53:56 +02:00
collections_test.go tests: Convert from testify to quicktest 2019-08-12 13:26:32 +02:00
config.go Make hugo.toml the new config.toml 2023-01-16 15:34:16 +01:00
config_test.go Make hugo.toml the new config.toml 2023-01-16 15:34:16 +01:00
configdir_test.go Improve error messages, esp. when the server is running 2022-05-06 19:43:22 +02:00
content_factory.go Add --force to hugo new 2022-09-08 15:35:11 +02:00
content_factory_test.go Add --force to hugo new 2022-09-08 15:35:11 +02:00
content_map.go Improve error messages, esp. when the server is running 2022-05-06 19:43:22 +02:00
content_map_page.go Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
content_map_test.go Fix HasMenuCurrent and IsDescendant/IsAncestor when comparing to itself 2022-05-28 10:56:54 +02:00
content_render_hooks_test.go Make .RenderString render shortcodes 2022-05-30 11:32:55 +02:00
datafiles_test.go Replace all usage of CopyOnWriteFs with OverlayFs 2022-04-10 13:49:31 +02:00
dates_test.go Fix raw TOML dates in where/eq 2022-06-07 13:02:58 +02:00
disableKinds_test.go all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
embedded_shortcodes_test.go all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
embedded_templates_test.go Remove empty href element from pagination template 2021-12-02 09:14:30 +01:00
fileInfo.go Improve error messages, esp. when the server is running 2022-05-06 19:43:22 +02:00
fileInfo_test.go tests: Convert from testify to quicktest 2019-08-12 13:26:32 +02:00
frontmatter_test.go Preserve front matter slice value types (e.g. int) 2023-01-17 08:58:05 +01:00
gitinfo.go Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
hugo_modules_test.go Replace all usage of CopyOnWriteFs with OverlayFs 2022-04-10 13:49:31 +02:00
hugo_sites.go Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
hugo_sites_build.go Filter out any duplicate files to post process 2022-09-14 19:42:55 +02:00
hugo_sites_build_errors_test.go errors: Misc improvements 2022-05-14 13:40:56 +02:00
hugo_sites_build_test.go modules: Make the module.workspace=off as default (note) 2022-12-19 20:17:33 +01:00
hugo_sites_multihost_test.go all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
hugo_sites_rebuild_test.go all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
hugo_smoke_test.go Make the baseline benchmark's test files stable 2022-06-30 12:36:55 +02:00
image_test.go Rework the Destination filesystem to make --renderStaticToDisk work 2022-04-08 13:26:17 +02:00
integration_test.go Annotate test assertions 2022-12-22 18:53:12 +01:00
integrationtest_builder.go Make hugo.toml the new config.toml 2023-01-16 15:34:16 +01:00
language_content_dir_test.go Rework the Destination filesystem to make --renderStaticToDisk work 2022-04-08 13:26:17 +02:00
language_test.go Reduce binary size vs locale, update to CLDR v36.1 2021-08-02 19:40:32 +02:00
menu_test.go Fix HasMenuCurrent and IsDescendant/IsAncestor when comparing to itself 2022-05-28 10:56:54 +02:00
minify_publisher_test.go Revert "tpl/tplimpl: Use https in sitemap templates" 2022-12-22 08:53:58 +01:00
mount_filters_test.go Rework the Destination filesystem to make --renderStaticToDisk work 2022-04-08 13:26:17 +02:00
multilingual.go all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
page.go Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
page__common.go Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
page__content.go parser/pageparser: Don't store the byte slices 2022-07-09 16:03:11 +02:00
page__data.go all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
page__menus.go Simplify "active menu" logic for section menus 2021-07-20 17:50:59 +02:00
page__meta.go Preserve front matter slice value types (e.g. int) 2023-01-17 08:58:05 +01:00
page__new.go Fix panic with markdownify/RenderString with shortcode on Page with no content file 2022-06-01 12:04:55 +02:00
page__output.go Revise the fix for shortcode vs output format nilpointer 2022-10-26 13:00:21 +02:00
page__paginator.go all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
page__paths.go all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
page__per_output.go Add a cache for lexers.Get 2022-11-24 13:18:33 +01:00
page__position.go all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
page__ref.go Improve error messages, esp. when the server is running 2022-05-06 19:43:22 +02:00
page__tree.go resource/page: Slight adjustment of Page.Ancestors 2022-12-23 10:14:53 +01:00
page_kinds.go all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
page_permalink_test.go modules: Make the module.workspace=off as default (note) 2022-12-19 20:17:33 +01:00
page_test.go Only invoke a given cached partial once 2023-01-25 17:35:23 +01:00
page_unwrap.go Improve error messages, esp. when the server is running 2022-05-06 19:43:22 +02:00
page_unwrap_test.go all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
pagebundler_test.go Rework the Destination filesystem to make --renderStaticToDisk work 2022-04-08 13:26:17 +02:00
pagecollections.go hugofs: Make FileMeta a struct 2021-07-15 17:14:26 +02:00
pagecollections_test.go all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
pages_capture.go Also consider wrapped errors when checking for file IsNotExist errors 2022-12-14 13:51:06 +01:00
pages_capture_test.go all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
pages_language_merge_test.go tpl/lang: Handle nil values in lang.Merge 2022-04-23 22:22:50 +02:00
pages_process.go Fix /static performance regression from Hugo 0.103.0 2022-09-26 19:02:25 +02:00
pages_test.go Add a benchmark 2021-05-04 17:59:04 +02:00
paginator_test.go all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
permalinker.go all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
prune_resources.go cache/filecache: Add a cache prune func 2018-11-14 23:14:51 +01:00
renderstring_test.go Fix panic with markdownify/RenderString with shortcode on Page with no content file 2022-06-01 12:04:55 +02:00
resource_chain_test.go Only invoke a given cached partial once 2023-01-25 17:35:23 +01:00
robotstxt_test.go Rework the Destination filesystem to make --renderStaticToDisk work 2022-04-08 13:26:17 +02:00
rss_test.go Rework the Destination filesystem to make --renderStaticToDisk work 2022-04-08 13:26:17 +02:00
securitypolicies_test.go Add resources.GetRemote 2021-12-17 09:33:51 +01:00
shortcode.go Revise the fix for shortcode vs output format nilpointer 2022-10-26 13:00:21 +02:00
shortcode_page.go Add render template hooks for links and images 2019-12-18 11:44:40 +01:00
shortcode_test.go Avoid nilpointer when shortcode page content output nil 2022-10-26 13:00:21 +02:00
site.go Only invoke a given cached partial once 2023-01-25 17:35:23 +01:00
site_benchmark_new_test.go Add a TOML front matter benchmark 2021-07-27 19:27:54 +02:00
site_output.go all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
site_output_test.go Rework the Destination filesystem to make --renderStaticToDisk work 2022-04-08 13:26:17 +02:00
site_render.go Improve error messages, esp. when the server is running 2022-05-06 19:43:22 +02:00
site_sections.go Add Markdown diagrams and render hooks for code blocks 2022-02-24 18:59:50 +01:00
site_sections_test.go resource/page: Add Page.Ancestors 2022-12-23 10:14:53 +01:00
site_stats_test.go all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
site_test.go Remove Blackfriday markdown engine 2022-05-29 11:50:58 +02:00
site_url_test.go Rework the Destination filesystem to make --renderStaticToDisk work 2022-04-08 13:26:17 +02:00
siteJSONEncode_test.go all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
sitemap_test.go Rework the Destination filesystem to make --renderStaticToDisk work 2022-04-08 13:26:17 +02:00
taxonomy_test.go Fix taxonomy weight sort regression 2022-11-01 18:45:34 +01:00
template_test.go tpl/collections: Fix apply with namespaced template funcs 2022-01-17 09:50:48 +01:00
testhelpers_test.go Support PostProcess for all file types 2022-09-14 19:09:20 +02:00
translations.go hugolib: Exclude non-linkable pages from translations map 2022-12-22 18:53:12 +01:00