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

Apply IDE0300 to corelib (use collection expressions instead of new[]) #105122

Merged
merged 2 commits into from
Jul 19, 2024

Conversation

stephentoub
Copy link
Member

No description provided.

Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-meta
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@tannergooding tannergooding left a comment

Choose a reason for hiding this comment

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

This means many of these become stackallocs and now use the params ROSpan<T> overloads, correct?

@stephentoub
Copy link
Member Author

This means many of these become stackallocs and now use the params ROSpan overloads, correct?

For this particular round of changes, most if not all of the cases I converted were target typed to T[], so the collection expressions are still forced to produce an array. However, for any where the target type was instead span, or where it is an argument to a method that has an overload that takes a span instead, then the compiler will do better, either using stack allocation or using assembly data if all elements were constant and the target is read only.

@stephentoub
Copy link
Member Author

stephentoub commented Jul 19, 2024

/ba-g unknown failure was a wasi leg not running a test

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.

3 participants