-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Conversation
This brings down the size of Marvin.ComputeHash from 445 to 310 bytes Diff/before/after disassembly: https://gist.github.com/mikedn/026e692f8c5357b56f24dc2192d1abd9 |
Avoid unnecessary checked and signed arithmetic. Handle special cases such as cast between same size types and from byte sized types, the JIT is unable to optimize these cases currently.
cc @AndyAyersMS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikedn Thanks for doing this!
Looks like this gives us maybe another 5-10% improvement in the longer hash computations. My machine currently shows shorter computations a bit slower but I can't do a completely clean perf test right now. Will rerun these later today. |
Test failures (example) look unrelated, so am going to retry. @dotnet-bot retest Ubuntu x64 Checked Innerloop Build and Test |
@dotnet-bot retest Tizen armel Cross Checked Innerloop Build and Test |
Still measure a bit of a slowdown for some cases but when looking at diffs it doesn't make a lot of sense. So perhaps my baseline data (which came from the runs I did for #16654) is stale. (edit: reran the baseline and now it all looks good; note new results are now the leftmost column) Old data below |
Cool, need to figure out how to run these tests myself :) |
Just for the record, here's what I did -- only works if the bits you are changing live entirely in CoreCLR:
|
Avoid unnecessary checked and signed arithmetic. Handle special cases such as cast between same size types and from byte sized types, the JIT is unable to optimize these cases currently. Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
Avoid unnecessary checked and signed arithmetic. Handle special cases such as cast between same size types and from byte sized types, the JIT is unable to optimize these cases currently. Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
Avoid unnecessary checked and signed arithmetic. Handle special cases such as cast between same size types and from byte sized types, the JIT is unable to optimize these cases currently. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Avoid unnecessary checked and signed arithmetic. Handle special cases such as cast between same size types and from byte sized types, the JIT is unable to optimize these cases currently. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Avoid unnecessary checked and signed arithmetic. Handle special cases such as cast between same size types and from byte sized types, the JIT is unable to optimize these cases currently. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Hi @mikedn I am currently profiling XmlSerializer deserialization and I can see that your change has improved the perf for my particular scenario (https://github.com/dotnet/corefx/issues/27636) by 2,8% I have marked the Cast method with black circles, on the left is after, on the right before your change . Sorry for unnatural order ;) Nice improvement! |
Avoid unnecessary checked and signed arithmetic. Handle special cases such as cast between same size types and from byte sized types, the JIT is unable to optimize these cases currently. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Avoid unnecessary checked and signed arithmetic. Handle special cases such as cast between same size types and from byte sized types, the JIT is unable to optimize these cases currently.
Contributes to #15492
It would be nice to address some of the problems this code exposes in the JIT. But that will take a while so for now let's fix the source code...