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

Update type constraints and other optimizations #1111

Closed
2 tasks
Sergio0694 opened this issue Feb 12, 2020 · 0 comments · Fixed by #1122
Closed
2 tasks

Update type constraints and other optimizations #1111

Sergio0694 opened this issue Feb 12, 2020 · 0 comments · Fixed by #1122
Assignees
Projects
Milestone

Comments

@Sergio0694
Copy link
Member

This follows from a conversation with @JimBobSquarePants on gitter.

Overview

There are parts of the ImageSharp codebase that were written before C# 7.3 came out, so in particular there are two missing features: the unmanaged type constraint, and the readonly modifier for struct types, or struct members.

We should consider doing a polishing pass around the codebase, including:

  • Upgrading all the various struct constraints to unmanaged (eg. in where TPixel : unmanaged, IPixel<TPixel>, instead of the previous where TPixel : struct, IPixel<TPixel>)
  • Marking all the struct-s, or at least all the various method/property getters/etc. as readonly as possible (this is more expressive and avoids safety copies by the compiler)

In particular, some of these changes were in the (now reverted) commits in #1107: 4b7718e.

Roadmap

The plan now is to wait for #1107 and #1109 to be merged, and then proceed with these changes. Side note: another unrelated follow up to do when those PRs get merged is to reintroduce the changes from 1835475 and customize processors to let them pick the right value delegate depending on their needs.

@Sergio0694 Sergio0694 added this to the 1.0.0-rc1 milestone Feb 12, 2020
@Sergio0694 Sergio0694 self-assigned this Feb 12, 2020
@Sergio0694 Sergio0694 added this to To Do in ImageSharp via automation Feb 12, 2020
@Sergio0694 Sergio0694 changed the title Update type constraints to C# 7.3 and other optimizations Update type constraints and other optimizations Feb 12, 2020
This was referenced Feb 22, 2020
ImageSharp automation moved this from To Do to Done Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
ImageSharp
  
Done
Development

Successfully merging a pull request may close this issue.

1 participant