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

[NRBF] Remove array allocation when decoding decimals. #107797

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

teo-tsirpanis
Copy link
Contributor

By directly passing a collection expression to decimal's constructor, we avoid allocating an array on frameworks that have an overload that accepts a ReadOnlySpan<int>, in which case the span's memory is allocated on the stack.

By directly passing a collection expression to `decimal`'s constructor, we avoid allocating an array on frameworks that have an overload that accepts a `ReadOnlySpan<int>`, in which case the span's memory is allocated on the stack.
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 13, 2024
@teo-tsirpanis teo-tsirpanis added area-System.Formats.Nrbf and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Sep 13, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Sep 13, 2024
Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @teo-tsirpanis !

@adamsitnik adamsitnik merged commit 89f245e into dotnet:main Sep 20, 2024
81 of 85 checks passed
@teo-tsirpanis teo-tsirpanis deleted the patch-1 branch September 22, 2024 20:07
sirntar pushed a commit to sirntar/runtime that referenced this pull request Sep 30, 2024
By directly passing a collection expression to `decimal`'s constructor, we avoid allocating an array on frameworks that have an overload that accepts a `ReadOnlySpan<int>`, in which case the span's memory is allocated on the stack.
@github-actions github-actions bot locked and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Formats.Nrbf community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants