-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Description
Copying @jkotas' feedback here so we don't lose track of it:
#76162 (review)
If you are looking into squeezing more cycles from Enum formatting and parsing, you can try switching on underlying enum CorElementType as the very first thing (using a cached CorElementType for non-generic methods and intrinsic method for the generic methods), and then dispatch to specialized code for each underlying CorElementType.
The benefits of this approach should be:
- Avoid conversions to / from ulong type
- The array of values will be 2x smaller for the most common
intunderlying type- Eliminate generic code duplication for Enum methods since the switch will completely evaporate and the rest of the code will be all shared between different Enum types
This would mimic what the high-performance Enum packages out there use, except they typically do that using generic code stamping of the whole thing. Sharing the code per CorElementType should solve that problem.
PaulusParssinen