[go-nuts] Re: Table-driven benchmarks defeat inlining

2021-05-31 Thread peterGo
I got as far as this func BenchmarkPopCountSimple(b *testing.B) { sum := 0 // Avoid dead code elimination. for i := 0; i < b.N; i++ { sum += PopCount(0x1234567890abcdef) } } I added additional benchmarks func BenchmarkPopCountSimpleX(b *testing.B) { sum := 0 // Does not

Re: [go-nuts] Re: Value copy costs are not very predictable.

2021-05-31 Thread tapi...@gmail.com
On Monday, May 31, 2021 at 10:07:35 AM UTC-4 axel.wa...@googlemail.com wrote: > On Mon, May 31, 2021 at 3:30 PM tapi...@gmail.com > wrote: > >> On Sunday, May 30, 2021 at 12:54:02 PM UTC-4 axel.wa...@googlemail.com >> wrote: >> >>> That is very normal for micro-benchmarks on a ns scale. >>>

[go-nuts] Table-driven benchmarks defeat inlining

2021-05-31 Thread Paul S. R. Chisholm
This is not a serious problem, but it surprised me. (By the way, how can I post a message with code formatting?) I'd like to create table-driven benchmarks: https://blog.golang.org/subtests. To that end, I started with code from *The Go Programming Language*: // PopCount is based on an examp

Re: [go-nuts] Re: Value copy costs are not very predictable.

2021-05-31 Thread 'Axel Wagner' via golang-nuts
On Mon, May 31, 2021 at 3:30 PM tapi...@gmail.com wrote: > On Sunday, May 30, 2021 at 12:54:02 PM UTC-4 axel.wa...@googlemail.com > wrote: > >> That is very normal for micro-benchmarks on a ns scale. >> > The results are so constantly that I think it is more related to CPU cache > and the specifi

Re: [go-nuts] Re: Value copy costs are not very predictable.

2021-05-31 Thread tapi...@gmail.com
On Sunday, May 30, 2021 at 12:54:02 PM UTC-4 axel.wa...@googlemail.com wrote: > That is very normal for micro-benchmarks on a ns scale. > The results are so constantly that I think it is more related to CPU cache and the specified directives. > > On Sun, May 30, 2021 at 6:07 PM tapi...@gma

Re: [go-nuts] unpacking map[string]interface{} answer

2021-05-31 Thread Amit Saha
> On 31 May 2021, at 6:08 pm, natxo@gmail.com > wrote: > > ok, I think I understand how this library works, and posting this for future > reference in case someone needs it. > > The library uses this other library: > https://github.com/mitchellh/mapstructure >

[go-nuts] Re: unpacking map[string]interface{} answer

2021-05-31 Thread natxo....@gmail.com
ok, I think I understand how this library works, and posting this for future reference in case someone needs it. The library uses this other library: https://github.com/mitchellh/mapstructure So now I can do this and vim go will helpfully fill in the struct fields for me. client := foreman.Cl