Hello Pierre, Thank you for bringing up this issue.
May you share the code snippet that triggers this behavior? Thanks. On Fri, Aug 1, 2025 at 12:50 PM Pierre Durand <pierredur...@gmail.com> wrote: > Hello > > I noticed a weird behavior when I'm benchmarking with testing.B.Loop() > code that uses iterators . > The benchmark shows allocations where I start to iterate the iterator, and > where I declare variables (before the loop) that are used inside the > iterator loop. > I know that my code is not doing any allocation, so it's strange. > If I change my benchmark to use the old "range b.N", then it doesn't show > this strange behavior. > If I check allocations with "testing.AllocsPerRun", I don't see any > allocation. > > Is that a know issue ? Should I open a bug ? > What should I do ? Use the old benchmarking method ? > > Regards > > -- > 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. > To view this discussion visit > https://groups.google.com/d/msgid/golang-nuts/70456dc1-3380-40fd-951d-e52275bc48a5n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/70456dc1-3380-40fd-951d-e52275bc48a5n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Thanks, Junyang -- 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. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/CAE9LEsYY_7M4LAb0YRd0%2Bu9hib%3DMExfmUTb%3DvG4XoFaEMZpBQg%40mail.gmail.com.