func Benchmark_TerrorParallelGetting(b *testing.B) { errs := []Terror{ E_IO{}, E_Network{}, TE0{}, TE1{}, TE2{}, TE3{}, TE4{}, TE5{}, TE6{}, TE7{}, TE8{}, TE9{}, } b.SetParallelism(4) b.RunParallel(func(b *testing.PB) { var which int for b.Next() { which = (which + 1) % 12 err := errs[which] hier := GetHierarchy(reflect.TypeOf(err)) _ = hier } }) }