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

[C#] Use new decimal.GetBits overloads to reduce allocations when serializing decimal values #44237

Closed
georgevanburgh opened this issue Sep 26, 2024 · 1 comment · Fixed by #44238

Comments

@georgevanburgh
Copy link
Contributor

georgevanburgh commented Sep 26, 2024

Describe the enhancement requested

Similar to #41349, .NET 5 introduced new overloads for decimalGetBits for which allow the use of a stackalloc'ed span, and avoiding the allocation of a fresh byte array for each value serialized. This should (slightly) reduce the allocations associated with serializing C# decimal values.

int[] decimalBits = decimal.GetBits(value);

Component(s)

C#

@CurtHagenlocher
Copy link
Contributor

Issue resolved by pull request 44238
#44238

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants