func BenchmarkStructComplexFailureParallel(b *testing.B) { type Test struct { String string Float64 float64 } t := &Test{ String: "test", Float64: 1.123, } b.RunParallel(func(pb *testing.PB) { for pb.Next() { allocations.TestReflectStructAllocations(t) } }) }
func BenchmarkReflectStructPtr(b *testing.B) { type Test struct { String string Float64 float64 } t := &Test{ String: "test", Float64: 1.123, } // t := new(Test) // t.String = "test" // t.Float64 = 1.123 for n := 0; n < b.N; n++ { allocations.TestReflectStructAllocations(t) } }