Named results allocated on stack instead of register?

瀏覽次數:105 次
跳到第一則未讀訊息

tapi...@gmail.com

未讀,
2021年9月20日 中午12:39:512021/9/20
收件者:golang-nuts
Sometimes, a function with named results is slower.

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?


tapi...@gmail.com

未讀,
2021年9月21日 凌晨1:44:282021/9/21
收件者:golang-nuts
It looks this is related to code inlining.
If we add //go:noinline directive for the two functions,
then they have no performance difference.
回覆所有人
回覆作者
轉寄
0 則新訊息