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

Clean up in Number.Formatting.cs #110955

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented Dec 26, 2024

No description provided.

Copy link
Contributor

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

@EgorBo

This comment was marked as resolved.

@@ -1579,7 +1572,7 @@ internal static unsafe void WriteTwoDigits<TChar>(uint value, TChar* ptr) where

Unsafe.CopyBlockUnaligned(
Copy link
Member

Choose a reason for hiding this comment

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

This is basically just doing span.CopyTo, right?

Is the codegen significantly different if we switch to the safe version? Should we log an issue if there's some places that can't be constant folded down here?

Copy link
Member Author

@EgorBo EgorBo Dec 27, 2024

Choose a reason for hiding this comment

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

@tannergooding yep, that was my initial intent, but looks like for that we need to change too many methods from TChar* to Span in Number.Formatting. My initial attempt to do so had a terrible perf impact so I decided to file a general clean up first.

Should we log an issue

I guess we can specifically for this, but it all part of the general issue #94941

Copy link
Member

@tannergooding tannergooding Dec 27, 2024

Choose a reason for hiding this comment

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

The suggestion of logging an issue was mainly for the consideration of if Span.CopyTo was slower than Unsafe.CopyBlockUnaligned, no need for an issue to track the switch to using Span in general I don't think

Is it worth doing new Span(ptr, length).CopyTo(dest, length) in the meantime which should get us slightly better and then we can track the switch to use span everywhere separately?

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

Successfully merging this pull request may close these issues.

2 participants