-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Fix truncate benchmarks, add more benchmark tests for longer strings #13880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Nigel2392
wants to merge
10
commits into
gohugoio:master
Choose a base branch
from
Nigel2392:expand-truncate-benchmarks-clean
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix truncate benchmarks, add more benchmark tests for longer strings #13880
Nigel2392
wants to merge
10
commits into
gohugoio:master
from
Nigel2392:expand-truncate-benchmarks-clean
Conversation
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
|
The benchmark tests are all wrong, even previously. The strings should have been cast to |
From Github web
|
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
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: