Hi all, I have a few question regarding Go compiler optimizations.

How Go Compiler (gc) optimize methods with value or pointer receiver (or 
functions)?
Does a method with value receiver always create a copy of data to its stack 
or the copy happend if there's a write attempt to it (CoW, or used fields)?
>From what I know it always create a copy of data with DUFFCOPY, but I am 
not sure if there's another cases.

For example I have 2 methods. Value, pointer receiver, respectively:
[Link: https://godbolt.org/z/dhTxez5jK]
TEXT main.Donothing(SB), NOSPLIT|ABIInternal, $0-216
TEXT main.PtrDonothing(SB), NOSPLIT|ABIInternal, $0-8

Function `main.Donothing` has a big stack size compared `main.PtrDonothing`
And how does that affect inline budget

Thank you.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/d087e77b-788b-4e92-8eee-6179af6b3f2cn%40googlegroups.com.

Reply via email to