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

Improve ImmutableArrayBuilder<T> type in MVVM Toolkit generators #701

Merged
merged 3 commits into from
May 16, 2023

Conversation

Sergio0694
Copy link
Member

@Sergio0694 Sergio0694 commented May 16, 2023

Overview

This PR includes a couple tweaks to ImmutableArrayBuilder<T>:

  • Drops the ObjectPool<T> use, and just uses ArrayPool<T>. This means we can now also benefit from the automatic trimming that ArrayPool<T> implements if there is high GC pressure. Also, we're no longer reinventing the wheel here.
  • Make the type a ref struct, since we're never meant to pass this outside or box it.
  • Add ref scope annotations where needed

PR Checklist

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • PR doesn't include merge commits (always rebase on top of our main, if needed)
  • Tested code with current supported SDKs
  • 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
  • Every new API (including internal ones) has full XML docs
  • Code follows all style conventions

@Sergio0694 Sergio0694 added optimization ☄ Performance or memory usage improvements mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit analyzer 👓 A new analyzer being implemented or updated labels May 16, 2023
@Sergio0694
Copy link
Member Author

Hey @Youssef1313, would you mind taking a quick look when you have a minute? Thank you! 🙂

Copy link
Contributor

@Youssef1313 Youssef1313 left a comment

Choose a reason for hiding this comment

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

LGTM

@Sergio0694 Sergio0694 merged commit 91fdb77 into main May 16, 2023
Sergio0694 added a commit to CommunityToolkit/Labs-Windows that referenced this pull request May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer 👓 A new analyzer being implemented or updated mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit optimization ☄ Performance or memory usage improvements
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants