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

Optimize Matrix.Elements #47932

Merged
merged 3 commits into from
Feb 9, 2021
Merged

Conversation

JeremyKuhne
Copy link
Member

Just pin the array. There is no need to allocate native memory and copy.

Just pin the array. There is no need to allocate native memory and copy.
@ghost
Copy link

ghost commented Feb 5, 2021

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

Issue Details

Just pin the array. There is no need to allocate native memory and copy.

Author: JeremyKuhne
Assignees: -
Labels:

area-System.Drawing

Milestone: -

copy.X += (int)graphics.Transform.OffsetX;
copy.Y += (int)graphics.Transform.OffsetY;

using Matrix transform = graphics.Transform;
Copy link
Member

@stephentoub stephentoub Feb 7, 2021

Choose a reason for hiding this comment

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

Wow, a property that allocates and returns a new finalizable object on every access... awesome ;-)

Copy link
Member Author

Choose a reason for hiding this comment

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

I've got a proposal up to help address this, um, suboptimal pattern: #47940

@stephentoub stephentoub merged commit d8aa4c6 into dotnet:master Feb 9, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Mar 11, 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.

4 participants