Inline cost is estimated at compile time, not the real code. But I sorry to say "*new(T) has a smaller inline cost than T{}". it is a little larger in fact. The inline cost of new(T) is smaller than T{}. I got it mixed up.
On Tuesday, March 18, 2025 at 2:39:19 PM UTC+8 Dan Kortschak wrote: > On Mon, 2025-03-17 at 21:03 -0700, tapi...@gmail.com wrote: > > I prefer *new(T) over T{}, because not only the reason here, but also > > the former has a smaller inline cost. > > What do you mean by "inline cost"? > > https://godbolt.org/z/h8Krq7W8G > > -- 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/55a0168a-0e19-4f3f-85d1-2caf8988754dn%40googlegroups.com.