On Fri, Jan 27, 2017 at 1:15 AM, Ilya Kostarev <uvelichi...@gmail.com> wrote: > Just this > http://stackoverflow.com/questions/41861918/using-testing-benchmark-does-not-produce-any-output > Citation > > package main > > import "testing" > > func main() { > > result := testing.Benchmark(func(parentB *testing.B) { > parentB.Run("example", func(b *testing.B) { > for n := 0; n < b.N; n++ { > println("ok") > } > }) > }) > > println(result.String()) > > } > > This will print ok a couple times and then 0 0 ns/op but the benchmark > clearly did run something. > > Same on my machine. It really looks like a bug, or documentation > incorrectness/incompleteness.
I think it's a bug in how the Benchmark function handles sub-benchmarks. Please file an issue at https://golang.org/issue/new. Thanks. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.