Fix truncate benchmarks, add more benchmark tests for longer strings#13880
Open
Nigel2392 wants to merge 10 commits intogohugoio:masterfrom
Open
Fix truncate benchmarks, add more benchmark tests for longer strings#13880Nigel2392 wants to merge 10 commits intogohugoio:masterfrom
Nigel2392 wants to merge 10 commits intogohugoio:masterfrom
Conversation
Contributor
Author
|
The benchmark tests are all wrong, even previously. The strings should have been cast to |
From Github web
Contributor
Author
|
The new benchmark results: BenchmarkTruncate/Plain_text-12 6716235 182.9 ns/op 16 B/op 1 allocs/op
BenchmarkTruncate/With_link-12 983589 1286 ns/op 161 B/op 5 allocs/op
BenchmarkTruncate/Plain_text_(medium)-12 204534 5946 ns/op 384 B/op 1 allocs/op
BenchmarkTruncate/With_HTML_(medium)-12 45519 25717 ns/op 2003 B/op 24 allocs/op
BenchmarkTruncate/Plain_text_(long)-12 41742 28162 ns/op 2048 B/op 1 allocs/op
BenchmarkTruncate/HTML_text_(long)-12 8776 144759 ns/op 4657 B/op 48 allocs/op |
…/Nigel2392/hugo into expand-truncate-benchmarks-clean
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The benchmark tests for
strings.(Namespace).Truncatewas rather simple, only testing for very short strings.I have added 4 benchmarks, one for long and medium plain text and one for long and medium HTML text.
Results (from my local machine) can be seen in the following table: