Replies: 1 comment 3 replies
-
|
Thanks for reporting this issue, it seems to be running into an edge case - stackalloc inside a method with loops, jit conservatively immediately self-promotes itself to the final tier (FullOpts): It is something we want to eventually fix, for now, we can workaround it - JIT shouldn't give up on small constant sized stackallocs (<=32b) as we promote those to locals. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I ran benchmarks to test the devirtualization and
static readonlyconstant folding of .NET 10 that were described in the Performance Improvements in .NET 10 Dev Blog by Stephen Toub but observed that the two don't seem to work as I would have expected in the following scenario:I understand that the compiler removes the whole first line of the
Constmethod via dead-code elimination and that this method is thus equal toBaselinebut this is sadly where my expertise ends. I hope that someone can answer me as many of the following questions as possible:StaticReadonly? The issue cannot be explained by missing devirtualization alone, since the same behavior appears in the .NET 9 runs where devirtualization does not occur.UseStackallocas constant and eliminate the first line of theStaticReadonlymethod, as the compiler does for theConstmethod?I am thankful for all answers and everything new that I am able to learn 🙏
Beta Was this translation helpful? Give feedback.
All reactions