This repository has been archived by the owner on Dec 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 701
reduce allocations when printing stack traces (#149) #150
Merged
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
Would you like any additional work done for this pull req @davecheney ? |
davecheney
added a commit
that referenced
this pull request
Jan 9, 2019
davecheney
added a commit
that referenced
this pull request
Jan 9, 2019
Updates #150 Signed-off-by: Dave Cheney <dave@cheney.net>
davecheney
added a commit
that referenced
this pull request
Jan 9, 2019
Updates #150 Signed-off-by: Dave Cheney <dave@cheney.net>
davecheney
added a commit
that referenced
this pull request
Jan 9, 2019
Updates #150 Signed-off-by: Dave Cheney <dave@cheney.net>
davecheney
added a commit
that referenced
this pull request
Jan 9, 2019
Updates #150 Signed-off-by: Dave Cheney <dave@cheney.net>
@davecheney I'm glad to see performance improvements get in, was there any improvements I could have made to the patch that could have allowed me to maintain authorship? I was trying to follow the commits above to see if I made any mistakes, from the diff it appears you didn't want to Grow a buffer? This has a pretty big impact on performance of the patch in the common %+v scenario: BenchmarkStackFormatting/%+v-stack-10-24 15221 21093 +38.58%
BenchmarkStackFormatting/%+v-stack-30-24 28797 43941 +52.59%
BenchmarkStackFormatting/%+v-stack-60-24 28479 42015 +47.53%
BenchmarkStackFormatting/%+v-stack-10-24 6 19 +216.67%
BenchmarkStackFormatting/%+v-stack-30-24 3 33 +1000.00%
BenchmarkStackFormatting/%+v-stack-60-24 3 33 +1000.00% That said I would have been happy to remove it to maintain authorship for the work I put into fixing this and patiently waiting for it to be reviewed and merged, just something to consider for your future contributors. Thanks. |
Please send a diff with the grow change. When I merged your change I found that it didn’t affect the benchmarks so I removed it. Please feel free to send a PR with it added back.
Sorry about obscuring the authorship, merge conflict and reverting other changes to this file were the cause.
… On 28 Jan 2019, at 03:53, Chris Stockton ***@***.***> wrote:
@davecheney I'm glad to see performance improvements get in, was there any improvements I could have made to the patch that could have allowed me to maintain authorship?
I was trying to follow the commits above to see if I made any mistakes, from the diff it appears you didn't want to Grow a buffer? This has a pretty big impact on performance of the patch in the common %+v scenario:
BenchmarkStackFormatting/%+v-stack-10-24 15221 21093 +38.58%
BenchmarkStackFormatting/%+v-stack-30-24 28797 43941 +52.59%
BenchmarkStackFormatting/%+v-stack-60-24 28479 42015 +47.53%
BenchmarkStackFormatting/%+v-stack-10-24 6 19 +216.67%
BenchmarkStackFormatting/%+v-stack-30-24 3 33 +1000.00%
BenchmarkStackFormatting/%+v-stack-60-24 3 33 +1000.00%
That said I would have been happy to remove it to maintain authorship for the work I put into fixing this and patiently waiting for it to be reviewed and merged, just something to consider for your future contributors. Thanks.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This implements proposal in #149 by adding a format method to
Frame
that accepts anio.Writer
, allowingstack
andStackTrace
to grow abytes.Buffer
ahead of time. The benefits are illustrated in the benchmark comparison below, in summary allocations are reduced by 90-97% resulting in a 40-55% performance boost.This comes at a slight cost in bytes used, which is around 5% higher on average with a single case reaching 36% (small stack, %s) which is probably not worth special casing. This trade off can be affected by adjusting stackMinLen with a more generous multiplier, lowering allocations at the expense of unused buffer.