Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change a byte[] in KnownColorTable to be ReadOnlySpan<byte> #51719

Merged
merged 1 commit into from
Apr 23, 2021

Conversation

stephentoub
Copy link
Member

cc: @safern

@ghost
Copy link

ghost commented Apr 23, 2021

Tagging subscribers to this area: @safern, @tarekgh
See info in area-owners.md if you want to be subscribed.

Issue Details

cc: @safern

Author: stephentoub
Assignees: -
Labels:

area-System.Drawing

Milestone: -

Copy link
Member

@safern safern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@gfoidl
Copy link
Member

gfoidl commented Apr 23, 2021

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.

@stephentoub
Copy link
Member Author

We'll need #24961 and Roslyn support for it before we can start using this with types other than byte, sbyte, and bool.

@stephentoub stephentoub merged commit 23d16da into dotnet:main Apr 23, 2021
@stephentoub stephentoub deleted the colortablespan branch April 23, 2021 10:59
@stephentoub
Copy link
Member Author

Curious did you find this in auditing memory on some app or anything?

I was going back through some PRs I hadn't reviewed and saw the array rather than span being introduced in #50489.

@karelz karelz modified the milestones: 5.0.x, 6.0.0 May 20, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants