The following program (reported by @WhiteBlackGoose):
publicclassProgram{structRangeEnumerator{privatereadonlyintto;privatereadonlyintstep;privateintcurr;publicboolMoveNext(){curr+=step;returncurr!=to;}publicintCurrent=>curr;}staticintEnumerateItAll(RangeEnumeratorenumerator){vara=0;while(enumerator.MoveNext())a+=enumerator.Current;returna;}}here is the assembly diff for EnumerateItAll method between Win-x64 and Linux-x64: https://www.diffchecker.com/NorefcMS
Windows one looks much better and there are no spills in the Loop body leading to much better performance.
I've not investigated this one yet - from my understanding RangeEnumerator is passed by stack on win-x64 ABI and via registers on lin-x64. Is there anything we can do here for Linux or it's a dup for some "first class structs promotion" issue? cc @dotnet/jit-contrib @kunalspathak
category:cq
theme:stack-allocation
The following program (reported by @WhiteBlackGoose):
here is the assembly diff for
EnumerateItAllmethod between Win-x64 and Linux-x64: https://www.diffchecker.com/NorefcMSWindows one looks much better and there are no spills in the Loop body leading to much better performance.
I've not investigated this one yet - from my understanding
RangeEnumeratoris passed by stack on win-x64 ABI and via registers on lin-x64. Is there anything we can do here for Linux or it's a dup for some "first class structs promotion" issue? cc @dotnet/jit-contrib @kunalspathakcategory:cq
theme:stack-allocation