$ go run ./p7uGl0JZ_TR.go NoEmbedStruct without pool: 1.558109ms with pool: 89.337184ms EmbedStruct without pool: 651.618531ms with pool: 84.505615ms # https://stackoverflow.com/questions/45003259/passing-an-optimization-flag-to-a-go-compiler # -N : Disable optimizations # -l : Disable inlining $ go run -gcflags '-N -l' ./p7uGl0JZ_TR.go NoEmbedStruct without pool: 139.720966ms with pool: 97.43476ms EmbedStruct without pool: 672.334312ms with pool: 91.052924ms # new(Data) 改寫成 Data{b:make([]byte, 1024)} $ go run ./p7uGl0JZ_TR.go NoEmbedStruct without pool: 1.330158ms with pool: 82.081171ms EmbedStruct without pool: 1.304114ms with pool: 80.288109ms $ go run -gcflags '-N -l' ./p7uGl0JZ_TR.go NoEmbedStruct without pool: 136.941637ms with pool: 94.261001ms EmbedStruct without pool: 102.397449ms with pool: 89.48266ms