-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
testing: report allocations in the BenchmarkResult struct Stringer #24296
Comments
This is not the expected behaviour. Can you please provide the code sample that produced the output above. |
Sure, here is the playground link, crippled a bit to give you some output (ie, doesn't use The sources for the |
Can you demonstrate this failure with a normal _test.go test? You don't
need to use the playground.
…On 7 March 2018 at 23:18, Tit Petric ***@***.***> wrote:
Sure, here is the playground link <https://play.golang.org/p/xKnapThDcui>,
crippled a bit to give you some output (ie, doesn't use b.N).
The sources for the func (r BenchmarkResult) String() string here
<https://golang.org/src/testing/benchmark.go?s=9060:9100#L324> basically
don't give a call to r.MemString(), or have access to B.showAllocResult,
because the *B or showAllocResult isn't copied into the struct.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#24296 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAcAz2JbxlLZ1zL_vqqVONsVzY0tyvUks5tb9AggaJpZM4SgVFJ>
.
|
Sorry, ignore my last request. This isn't a bug, this is a feature request.
…On 7 March 2018 at 23:19, Dave Cheney ***@***.***> wrote:
Can you demonstrate this failure with a normal _test.go test? You don't
need to use the playground.
On 7 March 2018 at 23:18, Tit Petric ***@***.***> wrote:
> Sure, here is the playground link <https://play.golang.org/p/xKnapThDcui>,
> crippled a bit to give you some output (ie, doesn't use b.N).
>
> The sources for the func (r BenchmarkResult) String() string here
> <https://golang.org/src/testing/benchmark.go?s=9060:9100#L324> basically
> don't give a call to r.MemString(), or have access to B.showAllocResult,
> because the *B or showAllocResult isn't copied into the struct.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#24296 (comment)>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AAAcAz2JbxlLZ1zL_vqqVONsVzY0tyvUks5tb9AggaJpZM4SgVFJ>
> .
>
|
Yes, feature request. It's an inconvenience with a work-around. Thanks for taking the time to understand it however :) |
Can you outline what your workaround is? I’m having trouble seeing it :) |
@andybons it's |
I don't think we should always print the memory results, and I don't think we should add a new field to |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.10
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?Not applicable
What did you do?
Call
testing.Benchmark
when usingb.ReportAllocs()
in the benchmark function.What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: