Bjørn Erik Pedersen
929808190f
tpl/partials: Fix recently introduced deadlock in partials cache
...
The change in lock logic for `partialCached` in 0927cf739f
was naive as it didn't consider cached partials calling other cached partials.
This changeset may look on the large side for this particular issue, but it pulls in part of a working branch, introducing `context.Context` in the template execution.
Note that the context is only partially implemented in this PR, but the upcoming use cases will, as one example, include having access to the top "dot" (e.g. `Page`) all the way down into partials and shortcodes etc.
The earlier benchmarks rerun against master:
```bash
name old time/op new time/op delta
IncludeCached-10 13.6ms ± 2% 13.8ms ± 1% ~ (p=0.343 n=4+4)
name old alloc/op new alloc/op delta
IncludeCached-10 5.30MB ± 0% 5.35MB ± 0% +0.96% (p=0.029 n=4+4)
name old allocs/op new allocs/op delta
IncludeCached-10 74.7k ± 0% 75.3k ± 0% +0.77% (p=0.029 n=4+4)
```
Fixes #9519
2022-02-17 18:47:36 +01:00
Bjørn Erik Pedersen
667f3a4ba8
tpl/partials: Add some more partials to BenchmarkIncludeCached
2022-02-17 16:45:59 +01:00
Bjørn Erik Pedersen
c061b253a4
deps: Update github.com/evanw/esbuild v0.14.11 => v0.14.22
2022-02-17 12:34:13 +01:00
Bjørn Erik Pedersen
0927cf739f
tpl/partials: Make sure a cached partial is invoked only once
...
This commit revises the locking strategy for `partialCached`. We have added a benchmark that may be a little artificial, but it should at least show that we're not losing any performance over this:
```bash
name old time/op new time/op delta
IncludeCached-10 12.2ms ± 2% 11.3ms ± 1% -7.36% (p=0.029 n=4+4)
name old alloc/op new alloc/op delta
IncludeCached-10 7.17MB ± 0% 5.09MB ± 0% -29.00% (p=0.029 n=4+4)
name old allocs/op new allocs/op delta
IncludeCached-10 128k ± 1% 70k ± 0% -45.42% (p=0.029 n=4+4)
```
This commit also revises the template metrics hints logic a little, and add a test for it, which output is currently this:
```bash
cumulative average maximum cache percent cached total
duration duration duration potential cached count count template
---------- -------- -------- --------- ------- ------ ----- --------
163.334µs 163.334µs 163.334µs 0 0 0 1 index.html
23.749µs 5.937µs 19.916µs 25 50 2 4 partials/dynamic1.html
9.625µs 4.812µs 6.75µs 100 50 1 2 partials/static1.html
7.625µs 7.625µs 7.625µs 100 0 0 1 partials/static2.html
```
Some notes:
* The duration now includes the cached invocations (which should be very short)
* A cached template gets executed once before it gets cached, so the "percent cached" will never be 100.
Fixes #4086
Fixes #9506
2022-02-17 11:53:24 +01:00
dependabot[bot]
26a5e89faa
build(deps): bump github.com/rogpeppe/go-internal from 1.8.0 to 1.8.1
...
Bumps [github.com/rogpeppe/go-internal](https://github.com/rogpeppe/go-internal ) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/rogpeppe/go-internal/releases )
- [Commits](https://github.com/rogpeppe/go-internal/compare/v1.8.0...v1.8.1 )
---
updated-dependencies:
- dependency-name: github.com/rogpeppe/go-internal
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-17 09:55:06 +01:00
dependabot[bot]
e9fa7e81b3
build(deps): bump github.com/magefile/mage from 1.11.0 to 1.12.1
...
Bumps [github.com/magefile/mage](https://github.com/magefile/mage ) from 1.11.0 to 1.12.1.
- [Release notes](https://github.com/magefile/mage/releases )
- [Changelog](https://github.com/magefile/mage/blob/master/.goreleaser.yml )
- [Commits](https://github.com/magefile/mage/compare/v1.11.0...v1.12.1 )
---
updated-dependencies:
- dependency-name: github.com/magefile/mage
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-17 09:54:29 +01:00
Joe Mooring
ff545f4276
markup/goldmark: Exclude event attributes from markdown render hook
...
Fixes #9511
2022-02-16 19:56:23 +01:00
Bjørn Erik Pedersen
b2a827c52c
markup/goldmark: Fix mangling of headers/links in render hooks
...
```bash
name old time/op new time/op delta
SiteWithRenderHooks-10 11.9ms ± 1% 11.9ms ± 1% ~ (p=0.486 n=4+4)
name old alloc/op new alloc/op delta
SiteWithRenderHooks-10 11.2MB ± 0% 11.3MB ± 0% +0.16% (p=0.029 n=4+4)
name old allocs/op new allocs/op delta
SiteWithRenderHooks-10 145k ± 0% 145k ± 0% +0.14% (p=0.029 n=4+4)
```
Fixes #9504
2022-02-16 17:46:30 +01:00
Bjørn Erik Pedersen
77c7059ff8
markup/goldmark: Add a render hook benchmark
...
Updates #9504
2022-02-16 13:30:53 +01:00
Bjørn Erik Pedersen
f4c90bd6ba
Fix BenchmarkCascadeTarget
2022-02-16 13:23:43 +01:00
Cameron Moore
d16228334d
metrics: Add cached count tracking
...
Track cached partial executions and display more useful info when
showing the hints output. Also group cache hints and counters together
to the right of the timing measurements.
Sample output:
cumulative average maximum cache percent cached total
duration duration duration potential cached count count template
---------- -------- -------- --------- ------- ------ ----- --------
2.6973ms 674.325µs 857.3µs 0 0 0 4 _internal/_default/rss.xml
2.6295ms 657.375µs 861.3µs 0 0 0 4 _default/single.html
1.2563ms 314.075µs 381.5µs 0 0 0 4 news/single.html
799.2µs 399.6µs 573.3µs 0 0 0 2 _internal/_default/sitemap.xml
667.3µs 66.73µs 238.6µs 84 0 0 10 partials/header.html
656.7µs 328.35µs 459.4µs 0 0 0 2 _default/list.html
479.7µs 47.97µs 158µs 92 0 0 10 partials/head.html
323.3µs 323.3µs 323.3µs 0 0 0 1 _internal/alias.html
200.7µs 200.7µs 200.7µs 0 0 0 1 _internal/_default/sitemapindex.xml
36.1µs 6.016µs 32.6µs 100 33 2 6 partials/footer.html
27.4µs 13.7µs 26.7µs 0 0 0 2 index.html
Fixes #8375
2022-02-16 10:05:17 +01:00
Bjørn Erik Pedersen
ea6bcd6944
tpl: Remove TODO comment
2022-02-15 23:39:54 +01:00
Bjørn Erik Pedersen
f2e7b49acf
Add --printUnusedTemplates
...
Fixes #9502
2022-02-15 20:01:57 +01:00
Joe Mooring
923419d7fd
deps: Update github.com/tdewolff/minify/v2 v2.9.22 => v2.9.29
...
Fixes #9244
Fixes #9132
Fixes https://discourse.gohugo.io/t/36523
2022-02-15 17:36:29 +01:00
Bjørn Erik Pedersen
837fdfdf45
commands: Rename --i18n-warnings to printI18nWarnings
...
To get it in line with the others.
2022-02-15 13:03:36 +01:00
Bjørn Erik Pedersen
6819feab6c
commands: Rename --path-warnings, --print-men to --printPathWarnings, --printMemoryUsage
...
To get it in line with the others.
2022-02-15 13:00:06 +01:00
Bjørn Erik Pedersen
ea54a99ca5
deps: Update github.com/alecthomas/chroma v0.9.4 => v0.10.0
2022-02-15 10:37:14 +01:00
Bjørn Erik Pedersen
9563c7d13b
Finally remove deprecated Page methods
...
They have been deprecated for a very long time, first with a warning, then with an ERROR. Now they are removed.
Closes #4117
2022-02-14 13:24:36 +01:00
Bjørn Erik Pedersen
c707b71cdf
Merge commit '230a495941b191af0bdaa7e2fc8c61607cb38207'
2022-02-14 12:58:42 +01:00
Bjørn Erik Pedersen
230a495941
Squashed 'docs/' changes from b8b20e9a2..93f7baf80
...
93f7baf80 netlify: Hugo 0.92.2
ecd8a6b6b Merge branch 'tempv0.92.2'
ee04caf9f Fix validation of Page Kind in cascade target map
3fce03ed2 Remove the "check" command
70ad71b25 Fix typo (#1651 )
dfd1dc570 Fix internal link (#1650 )
b5e0e0d38 Update rotten Fedora package link
78276390a Add missing word in types.md (#1645 )
45eb945f8 Remove hugo gen autocomplete
2f84d0896 netlify: Hugo 0.92.1
b55f5773b Update complement.md
7013ee43e Remove deprecated RSSLink from page variables
1c3fb6ed3 Remove deprecated page vars (#1638 )
9bd0af3ab Update union.md
4576487a0 Update symdiff.md
58f1b26c7 Update starter-kits.md (#1521 )
285356c1d Move inline partials section (#1635 )
4d08625d2 Improve directions for editing Win 10 path env var (#1632 )
41d9c7804 Update page content (#1629 )
d05536cad Removed unpaired quote character (#1630 )
3b0fdcd88 netlify: Bump to Hugo 0.92.0
cdb068346 docs: Regenerate docshelper
778503ca8 Merge commit 'a8e9fc699a6ff7d578f97a7c553ce844efad8fdb'
2d2401c91 docs: Add dependency table to maintainance page
6bc95c386 Add hugo.Deps
19d0b5e23 docs. Regen CLI docs
76a750d96 docs: Regenerate CLI docs
70156962a docs: Regenerate docshelper
git-subtree-dir: docs
git-subtree-split: 93f7baf80bd03176ad44701cd2452433d492ea0b
2022-02-14 12:58:42 +01:00
Bjørn Erik Pedersen
b0a9cf0a75
tpl: Use go:embed to load internal templates
...
Fixes #8297
2022-02-14 09:39:46 +01:00
hugoreleaser
9433cc2562
releaser: Prepare repository for 0.93.0-DEV
...
[ci skip]
2022-02-11 14:54:18 +00:00
hugoreleaser
cdf6a0d622
releaser: Bump versions for release of 0.92.2
...
[ci skip]
2022-02-11 14:17:39 +00:00
hugoreleaser
bf1fa71379
releaser: Add release notes for 0.92.2
...
[ci skip]
2022-02-11 14:17:38 +00:00
Joe Mooring
4f4cec73be
Add HUGO_ENV to the os/exec environment
...
Closes #9490
2022-02-11 08:30:26 +01:00
Bjørn Erik Pedersen
da4866c2be
Simplify some integration tests
2022-02-10 20:43:19 +01:00
Joe Mooring
d1109f590a
Fix validation of Page Kind in cascade target map
...
Fixes #8888
2022-02-10 20:42:31 +01:00
Bjørn Erik Pedersen
a7d182cea1
Add another cascade benchmark
2022-02-10 20:40:49 +01:00
Bjørn Erik Pedersen
a2a660ed12
commands: Fix server deadlock on config error
...
Fixes #9486
2022-02-10 19:43:47 +01:00
Joe Mooring
f7bc4cc505
Exclude event attributes when rendering markdown
...
Closes #9463
2022-02-10 18:25:19 +01:00
Joe Mooring
54f8d8a70a
Remove the "check" command
...
Closes #9454
2022-02-10 16:25:23 +01:00
Joe Mooring
3036d0ac9a
Update the application/javascript media type
...
Add jsm and mjs extensions.
Closes #9483
2022-02-10 11:51:28 +01:00
Bjørn Erik Pedersen
6a238a7276
tpl/templates: Fix templates.Exist issue with base templates
...
Fixes #9477
2022-02-09 22:33:07 +01:00
Bjørn Erik Pedersen
f60714b5a1
Add a migration test helper
2022-02-09 16:38:12 +01:00
Bjørn Erik Pedersen
215a715ddd
babel: Port integration tests to their own package
2022-02-09 15:41:32 +01:00
Bjørn Erik Pedersen
d128d260b5
js: Port integration tests to its own package
2022-02-09 15:41:32 +01:00
Bjørn Erik Pedersen
c4aaf1d516
postcss: Move integration test to its own package
2022-02-09 15:41:32 +01:00
Bjørn Erik Pedersen
94f10cf4f9
minifier: Port integration tests to its package
2022-02-09 15:41:32 +01:00
Bjørn Erik Pedersen
b06c2103b8
templates: Port integration test to its package
2022-02-09 15:41:32 +01:00
Bjørn Erik Pedersen
d22f7795c7
tocss: Port integration tests to their package
2022-02-09 15:41:32 +01:00
Bjørn Erik Pedersen
39f69ca7f0
openapi3: Port integration test into correct package
2022-02-09 15:41:32 +01:00
Bjørn Erik Pedersen
64f75adcf6
Add a new integration test framework
...
I have had this living in a separate branch for now, but we need this in the main branch sooner rather than later.
One big advantage of this is that integration tests can live in any package, not just hugolib.
2022-02-09 15:41:32 +01:00
Joe Mooring
9262719092
Validate comparison operator argument count
...
Fixes #9462
2022-02-05 17:41:43 +01:00
Joe Mooring
3336762939
Remove hugo gen autocomplete
...
Closes #8862
2022-02-01 23:23:30 +01:00
Bjørn Erik Pedersen
5ca40c8f7c
deps: Update github.com/pelletier/go-toml/v2 to v2.0.0-beta.6
...
Closes #9439
Closes #9417
2022-01-29 13:55:23 +01:00
Bjørn Erik Pedersen
ef7d14a241
Fix erroneous warning with .Page.RenderString on a page without a backing file
...
Fixes #9433
2022-01-28 17:35:49 +01:00
Joe Mooring
c05c99f0c5
Fix typo in panicOnWarning message
2022-01-27 17:50:34 +01:00
hugoreleaser
ff7689ce02
releaser: Prepare repository for 0.93.0-DEV
...
[ci skip]
2022-01-27 12:22:31 +00:00
hugoreleaser
85e2e86266
releaser: Bump versions for release of 0.92.1
...
[ci skip]
2022-01-27 11:44:40 +00:00
hugoreleaser
515f8a6d8e
releaser: Add release notes for 0.92.1
...
[ci skip]
2022-01-27 11:44:40 +00:00