Skip to content

Simplified namespaces in HighPerformance package #3687

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

Merged
5 commits merged into from
Feb 5, 2021

Conversation

Sergio0694
Copy link
Member

@Sergio0694 Sergio0694 commented Jan 23, 2021

Related to #3422

PR Type

What kind of change does this PR introduce?

  • Refactoring
  • Improvements

Overview

Following the suggestion from @mrlacey for non-breaking changes, this PR moves the new Span2D<T> and Memory2D<T> types introduced in version 7.0 to the root Microsoft.Toolkit.HighPerformance namespace (instead of .Memory). This is simpler to use for consumers, it makes sense given that the root namespace already contains some other "primitive" types, and it's also more consistent to how the Span<T> and Memory<T> types are included in the System.Memory package, but are still located in the root System namespace.

This PR also includes some minor codegen improvements to some other extensions, while I was at it 😄

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Pull Request has been submitted to the documentation repository instructions. Link:
  • Sample in sample app has been added / updated (for bug fixes / features)
  • New major technical changes in the toolkit have or will be added to the Wiki e.g. build changes, source generators, testing infrastructure, sample creation changes, etc...
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes

@Sergio0694 Sergio0694 added improvements ✨ high-performance 🚂 Issues/PRs for the Microsoft.Toolkit.HighPerformance package optimization ☄ Performance or memory usage improvements .NET Components which are .NET based (non UWP specific) labels Jan 23, 2021
@Sergio0694 Sergio0694 added this to the 7.0 milestone Jan 23, 2021
@ghost ghost added the in progress 🚧 label Jan 23, 2021
@ghost
Copy link

ghost commented Jan 23, 2021

Thanks Sergio0694 for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

@michael-hawker
Copy link
Member

FYI @Sergio0694 CI failing

@Sergio0694
Copy link
Member Author

@michael-hawker Whoops, forgot to update the expected strings in the unit tests 😄
Thanks, fixed it in 684294f!

@@ -58,7 +65,8 @@ public static unsafe int ToInt(this bool flag)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe int ToBitwiseMask32(this bool flag)
{
byte rangeFlag = *(byte*)&flag;
bool copy = flag;
Copy link
Member

Choose a reason for hiding this comment

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

Curious as to the change here? Just for my own understanding. 🙂

Copy link
Member

Choose a reason for hiding this comment

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

NVM missed the comment above. Should this be a compile optimization issue to file against .NET? @Sergio0694

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a known issue - they have explicit workarounds for this inside the runtime as well. For now we just need to remember to do this and work around it, thankfully the solution is easy enough, it's just not as clean as doing this directly. Will ask if there's any news on this though, we were just about talking about this a few days ago in the C# server 😄

@ghost
Copy link

ghost commented Feb 4, 2021

Hello @michael-hawker!

Because this pull request has the auto merge :zap: label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@Sergio0694 Sergio0694 force-pushed the refactoring/high-performance branch from 6af4b04 to 00677f2 Compare February 4, 2021 23:05
@ghost ghost merged commit 1ba2321 into CommunityToolkit:master Feb 5, 2021
@Sergio0694 Sergio0694 deleted the refactoring/high-performance branch February 5, 2021 10:56
Sergio0694 added a commit to Sergio0694/WindowsCommunityToolkitDocs that referenced this pull request Feb 20, 2021
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merge ⚡ high-performance 🚂 Issues/PRs for the Microsoft.Toolkit.HighPerformance package improvements ✨ in progress 🚧 .NET Components which are .NET based (non UWP specific) optimization ☄ Performance or memory usage improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants