Improve Enum.ToString performance (#6645)
Reduces allocations by 66%; increases performance by 600% (x7)
With these changes ToString no longer boxes the value and doesn't create an empty array for `CustomAttributeRecords` when the enum is not flagged; also caches whether the enum is flagged.
It still boxes the enum to Enum to make the ToString virtual call however.
Using the @jkotas enummark :wink:
```csharp
enum MyEnum { One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten };
public static void Main(string[] args)
{
(MyEnum.Seven).ToString();
int start = Environment.TickCount;
for (int i = 0; i <
10000000; i++)
{
(MyEnum.Seven).ToString();
}
int end = Environment.TickCount;
Console.WriteLine((end - start).ToString());
}
```
Pre: 5828ms, 5828ms, 5829ms (1.7M/s)
Post: 828ms, 828ms, 828ms (12.1M/s)