Change a byte[] in KnownColorTable to be ReadOnlySpan<byte> - #51719
Conversation
|
Tagging subscribers to this area: @safern, @tarekgh |
safern
left a comment
There was a problem hiding this comment.
Curious did you find this in auditing memory on some app or anything?
Should we also update s_colorValueTable to ReadOnlySpan<uint> or that doesn't help?
This doesn't help. The C# compiler's optimization to refer to the data-segment of the assembly directly only works for (primitive) types with one byte size (due to endianess concerns). See e.g. this sharplab. |
|
We'll need #24961 and Roslyn support for it before we can start using this with types other than byte, sbyte, and bool. |
I was going back through some PRs I hadn't reviewed and saw the array rather than span being introduced in #50489. |
cc: @safern