You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lazy calculate WordCount, ReadingTime and FuzzyWordCount
This avoids having to execute these expensive operations for sites not using these values.
This commit sums up a set of wordcounting and autosummary related performance improvements.
The effect of these kind of depends on what features your site use, but a benchmark from 4 Hugo sites in the wild shows promise:
```
benchmark old ns/op new ns/op delta
BenchmarkHugo-4 21293005843 20032857342 -5.92%
benchmark old allocs new allocs delta
BenchmarkHugo-4 65290922 65186032 -0.16%
benchmark old bytes new bytes delta
BenchmarkHugo-4 9771213416 9681866464 -0.91%
```
checkPageContent(t, p, normalizeExpected(ext, "<p>Summary Next Line. <figure ><img src=\"/not/real\" /></figure>.\nMore text here.</p><p>Some more text</p>"), ext)
714
-
checkPageSummary(t, p, "Summary Next Line. . More text here. Some more text", ext)
716
+
checkPageContent(t, p, normalizeExpected(ext, "<p>Summary Next Line. \n<figure >\n\n<img src=\"/not/real\" />\n\n\n</figure>\n.\nMore text here.</p>\n\n<p>Some more text</p>\n"))
717
+
checkPageSummary(t, p, "Summary Next Line. . More text here. Some more text")
0 commit comments