Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: huge waste stack when make function calls #38588
linux x64, go 1.14;
I don't know what is the extra 80 bytes for (96bytes - 8bytes for argment - 8 bytes for return address). Maybe rbp need 8 bytes? Well, at least 60+ bytes is wasted for nothing.
And 0x60 seems to be the smallest, I have seen 204 bytes being used, and in fact, there are only 5 local variables in the function, 8 bytes each.
Because of this, when there are more calling frames, the stack will drain quickly and newstack will get called to expand the stack, which is much slower, because of alloc, memory copy, and update pointers...; As a result, It took 50+% of executing time of my code.
All that space makes sense to me.
We can't really make it smaller without going to a register-based calling convention (issue #18597). I'm going to close this as not actionable / working as intended.