Switching Enum.HasFlag calls with bitwise operations#953
Conversation
|
|
Interesting... I've definitely seen unnecessary allocations when running a profiler, which I don't see any longer, so I'm not sure why that would be the case. |
It shouldn't be boxing in even in debug mode or Tier-0 codegen anymore (I could be wrong here). But if there clearly is difference with profiler runs I think the changes should then stay. It definitely gets eliminated in Tier-1 (i.e. fully optimized hot code) 😅 update: checked few places, the change that optimized |
|
That's good to know! Thanks for looking into it! |
Switching a few areas in the code from using Enum.HasFlag (which apparently uses reflection and thus incur overhead) to using more efficient bitwise operations.