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

Use ReadOnlySpan<T> properties instead of static array fields #71291

Open
alrz opened this issue Dec 16, 2023 · 4 comments
Open

Use ReadOnlySpan<T> properties instead of static array fields #71291

alrz opened this issue Dec 16, 2023 · 4 comments
Labels
Area-Compilers Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality
Milestone

Comments

@alrz
Copy link
Member

alrz commented Dec 16, 2023

The similar change in runtime: https://github.com/dotnet/runtime/pull/79461/files among others.

@alrz
Copy link
Member Author

alrz commented Dec 16, 2023

Is there any requirement that's blocking this change in roslyn?

Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Dec 16, 2023
@jcouv jcouv added the Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality label Dec 18, 2023
@jcouv jcouv added this to the Backlog milestone Jan 8, 2024
@jcouv jcouv added Area-Compilers and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 8, 2024
@alrz
Copy link
Member Author

alrz commented Mar 8, 2024

Love to see this coming through, there's already a PR for an analyzer at dotnet/roslyn-analyzers#5548
@CyrusNajmabadi any chance it could get merged?

It doesn't support 2d arrays at the moment of which there's a few in roslyn, but I think for 2d arrays we could initialize a flat span and adjust the indexer call to point to to the desired element.

@sharwell
Copy link
Member

sharwell commented Mar 8, 2024

@alrz RuntimeHelpers.CreateSpan doesn't exist in a bunch of the frameworks we target. I would not expect this change to proceed unless it was clearly shown to have no negative performance impact on net472 and netstandard2.0 usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality
Projects
None yet
Development

No branches or pull requests

3 participants