Skip to content
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

Cleanup for more readable + benchmark ExtractStacktrace #469

Merged
merged 5 commits into from Sep 1, 2022

Conversation

YaroslavPodorvanov
Copy link
Contributor

In performance nothing change

benchstat old.txt new.txt
name                  old time/op    new time/op    delta
ExtractStacktrace-12    6.73µs ±17%    6.59µs ±16%   ~     (p=0.057 n=98+98)

name                  old alloc/op   new alloc/op   delta
ExtractStacktrace-12    2.56kB ± 0%    2.56kB ± 0%   ~     (all equal)

name                  old allocs/op  new allocs/op  delta
ExtractStacktrace-12      26.0 ± 0%      26.0 ± 0%   ~     (all equal)

@@ -73,39 +73,38 @@ func ExtractStacktrace(err error) *Stacktrace {
}

func extractReflectedStacktraceMethod(err error) reflect.Value {
var method reflect.Value
errValue := reflect.ValueOf(err)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reflect.ValueOf once instead of multi

@@ -255,6 +255,21 @@ func TestExtractStacktrace(t *testing.T) {
}
}

func BenchmarkExtractStacktrace(b *testing.B) {
var fs = []func() error{
RedPkgErrorsRanger,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as in tests

Copy link
Contributor

@kamilogorek kamilogorek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 🙇

@kamilogorek kamilogorek merged commit 64b90ef into getsentry:master Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants