-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
perf: avoid unnecessary byteslice->string before fmt %s verb #10364
Merged
mergify
merged 1 commit into
cosmos:master
from
orijtech:remove-fmt-unnecessary-byteslice-
Oct 14, 2021
Merged
perf: avoid unnecessary byteslice->string before fmt %s verb #10364
mergify
merged 1 commit into
cosmos:master
from
orijtech:remove-fmt-unnecessary-byteslice-
Oct 14, 2021
Conversation
This file contains 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
github-actions
bot
added
C:CLI
C:Keys
Keybase, KMS and HSMs
C:Simulations
C:x/capability
C:x/genutil
genutil module issues
C:x/params
C:x/upgrade
labels
Oct 14, 2021
odeke-em
changed the title
all: avoid unnecessary byteslice->string before fmt %s verb
fix! all: avoid unnecessary byteslice->string before fmt %s verb
Oct 14, 2021
Codecov Report
@@ Coverage Diff @@
## master #10364 +/- ##
==========================================
- Coverage 64.27% 64.24% -0.04%
==========================================
Files 572 572
Lines 54158 54158
==========================================
- Hits 34811 34793 -18
- Misses 17366 17385 +19
+ Partials 1981 1980 -1
|
fmt.Printf or fmt.Sprintf already know how to convert a byteslice into a string when building the output; we shouldn't incur the unnecessary string(byteslice) conversion. Using Bencher, we can see improvements such as https://dashboard.github.orijtech.com/benchmark/3245b8e4bbbd44a597480319aaa4b9fe which in independent experiments show: * time/op (ns/op) FormatIt-8 1.2µs ± 2% 1.1µs ± 10% -11.77% (p=0.000 n=10+9) * speed (MB/s) FormatIt-8 0.71GB/s ± 2% 0.80GB/s ± 9% +13.59% (p=0.000 n=10+9) * allocs/op (B/op) FormatIt-8 2.0kB ± 0% 1.1kB ± 0% -45.62% (p=0.000 n=10+10) * allocs/op (count/op) FormatIt-8 11 ± 0% 9.0 ± 0% -18.18% (p=0.000 n=10+10) Fixes #10363
odeke-em
changed the title
fix! all: avoid unnecessary byteslice->string before fmt %s verb
perf: avoid unnecessary byteslice->string before fmt %s verb
Oct 14, 2021
tac0turtle
approved these changes
Oct 14, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thank you
tac0turtle
added
the
A:automerge
Automatically merge PR once all prerequisites pass.
label
Oct 14, 2021
amaury1093
approved these changes
Oct 14, 2021
This was referenced Oct 13, 2024
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A:automerge
Automatically merge PR once all prerequisites pass.
C:CLI
C:Keys
Keybase, KMS and HSMs
C:Simulations
C:x/capability
C:x/genutil
genutil module issues
C:x/params
C:x/upgrade
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.
fmt.Printf or fmt.Sprintf already know how to convert a
byteslice into a string when building the output; we shouldn't
incur the unnecessary string(byteslice) conversion.
Using Bencher, we can see improvements such as
https://dashboard.github.orijtech.com/benchmark/3245b8e4bbbd44a597480319aaa4b9fe
which in independent experiments show:
time/op (ns/op)
FormatIt-8 1.2µs ± 2% 1.1µs ± 10% -11.77% (p=0.000 n=10+9)
speed (MB/s)
FormatIt-8 0.71GB/s ± 2% 0.80GB/s ± 9% +13.59% (p=0.000 n=10+9)
allocs/op (B/op)
FormatIt-8 2.0kB ± 0% 1.1kB ± 0% -45.62% (p=0.000 n=10+10)
allocs/op (count/op)
FormatIt-8 11 ± 0% 9.0 ± 0% -18.18% (p=0.000 n=10+10)
Fixes #10363