Skip to content

Conversation

@bep
Copy link
Member

@bep bep commented Aug 20, 2016

In total, the effect with this branch compared with master:

benchmark           old ns/op      new ns/op      delta
BenchmarkHugo-4     3166246627     3038050615     -4.05%

benchmark           old allocs     new allocs     delta
BenchmarkHugo-4     10557420       10540152       -0.16%

benchmark           old bytes      new bytes      delta
BenchmarkHugo-4     1621203992     1605716520     -0.96%

See: https://github.com/bep/hugo-benchmark

Word counting benchmark:

BenchmarkTotalWords-4            100000         18795 ns/op           0  B/op           0 allocs/op 
BenchmarkTotalWordsOld-4          30000         46751 ns/op           6400 B/op           1 allocs/op

New auto-summary benchmark:

BenchmarkTestTruncateWordsToWholeSentence-4            300000         4720 ns/op         0 B/op              0 allocs/op
BenchmarkTestTruncateWordsToWholeSentenceOld-4         100000         17699 ns/op        3072 B/op           3 allocs/op
@bep bep changed the title WIP: Make summary, wordcount more effective Aug 20, 2016
@bep bep force-pushed the truncate-whole-sentence branch from 8f751b1 to 83ccd02 Compare August 24, 2016 15:51
@bep bep changed the title WIP: Make summary, wordcount etc. more effective Aug 24, 2016
@bep bep mentioned this pull request Aug 24, 2016
27 tasks
@bep bep force-pushed the truncate-whole-sentence branch from 83ccd02 to c4cf45c Compare September 8, 2016 19:14
bep added 2 commits September 14, 2016 10:09
For people using autogenerated summaries, this is one of the hot spots in the memory department.

We don't need to split al the content into words to do proper summary truncation.

This is obviously more effective:

```
BenchmarkTestTruncateWordsToWholeSentence-4            300000          4720 ns/op           0 B/op           0 allocs/op
BenchmarkTestTruncateWordsToWholeSentenceOld-4         100000         17699 ns/op        3072 B/op           3 allocs/op
```
It is obviously more efficient when we do not care about the actual words.

```
BenchmarkTotalWords-4            100000         18795 ns/op           0 B/op           0 allocs/op
BenchmarkTotalWordsOld-4          30000         46751 ns/op        6400 B/op           1 allocs/op
```
@bep bep force-pushed the truncate-whole-sentence branch from c4cf45c to 1145eba Compare September 14, 2016 08:09
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%
```
@bep bep force-pushed the truncate-whole-sentence branch from 1145eba to dfdcbe0 Compare September 14, 2016 08:30
@bep bep closed this in dd45e6d Sep 14, 2016
@bep bep deleted the truncate-whole-sentence branch April 18, 2017 09:19
tychoish pushed a commit to tychoish/hugo that referenced this pull request Aug 13, 2017
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%
```

Closes gohugoio#2378
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

2 participants