Revisiting https://github.com/dotnet/coreclr/issues/111
Using repo example manged code; shows pre-cached boxes for common values can improve the performance of boxing (see below). Is there a way of building this into the jit or runtime?
Or is this just madness?
Integer Box Caching
Method | Mean | StdDev | Median | Scaled | RPS |
------------------------- |---------- |---------- |---------- |------- |--------------- |
Int32UncachedBoxing | 7.4069 ns | 0.0498 ns | 7.3884 ns | 1.00 | 135,008,742.93 |
Int32CachedBoxing | 5.3065 ns | 0.0495 ns | 5.3282 ns | 0.72 | 188,448,857.58 |
Int32CachedBoxExtenstion | 6.7465 ns | 0.0880 ns | 6.7784 ns | 0.91 | 148,226,092.97 |
Boolean Box Caching
Method | Mean | StdDev | Median | Scaled | RPS |
------------------------ |---------- |---------- |---------- |------- |--------------- |
BoolUncachedBoxing | 7.3923 ns | 0.0391 ns | 7.3866 ns | 1.00 | 135,276,250.40 |
BoolCachedBoxing | 4.5859 ns | 0.0310 ns | 4.5954 ns | 0.62 | 218,057,656.08 |
BoolCachedBoxExtenstion | 4.5874 ns | 0.0428 ns | 4.5988 ns | 0.62 | 217,986,777.33 |
Suggestion, cache boxes for:
bool: true, falue
byte: 0 to 255
char: 0 to 127
int/short: -128 to 127
Maybe others?
Gave it a go benaadams/coreclr@2f7726d, but not entirely sure what I'm doing, so you probably have a bunch of really weird Dr Watson reports...
Edit Updated with metrics post https://github.com/dotnet/coreclr/issues/8423#issuecomment-264500921
Revisiting https://github.com/dotnet/coreclr/issues/111
Using repo example manged code; shows pre-cached boxes for common values can improve the performance of boxing (see below). Is there a way of building this into the jit or runtime?
Or is this just madness?
Integer Box Caching
Boolean Box Caching
Suggestion, cache boxes for:
bool: true, falue
byte: 0 to 255
char: 0 to 127
int/short: -128 to 127
Maybe others?
Gave it a go benaadams/coreclr@2f7726d, but not entirely sure what I'm doing, so you probably have a bunch of really weird Dr Watson reports...
Edit Updated with metrics post https://github.com/dotnet/coreclr/issues/8423#issuecomment-264500921