It looks this is related to code inlining.
If we add //go:noinline directive for the two functions,
then they have no performance difference.

On Monday, September 20, 2021 at 12:39:51 PM UTC-4 tapi...@gmail.com wrote:

> Sometimes, a function with named results is slower.
> For example: https://play.golang.org/p/wvWkfSRqDLr
>
> The generated directives are almost the same for the two
> functions with a named and unnamed result, except one difference.
> For the function with the named result, the result represents as "".ret
> in the generated directive, but for the function with the unnamed result,
> the result represents as "".~r1 in the generated directive.
>
> Does "".ret means the result is allocated on stack? 
>
>
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f962870a-17a4-4691-8f8d-282d27373018n%40googlegroups.com.

Reply via email to