-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Remove unnecessary endianness dependent logic #104332
Conversation
/azp run runtime-community |
Azure Pipelines successfully started running 1 pipeline(s). |
Tagging subscribers to this area: @dotnet/area-system-memory |
Why? |
I think I had build error for |
Now I know why I did this, writing |
/azp run runtime-community |
Azure Pipelines successfully started running 1 pipeline(s). |
But writing to a ulong would work in that case, no? |
Did not think about that 😄. Though it looks to me more efficient, no? Compared to doing several |
According to the local perf test, turns out the old approach is bit more performant, reverted to old approach except the case where padding is omitted and not writing 4 bytes to destination |
src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Base64Url/Base64UrlEncoder.cs
Outdated
Show resolved
Hide resolved
/azp run runtime-community |
Azure Pipelines successfully started running 1 pipeline(s). |
@buyaa-n The s390x community CI was timing out since last week, This has been fixed now. can you please re-run the CI? |
/azp run runtime-community |
Azure Pipelines successfully started running 1 pipeline(s). |
Failures are unrelated and known |
Before my PR #102364 the Base64Encoder was populating uint by concatenating encoded 4 bytes (by accounting the endianness)
runtime/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Base64Encoder.cs
Lines 533 to 545 in 4a37e73
and was writing that uint to the destination buffer:
runtime/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Base64Encoder.cs
Lines 95 to 96 in 4a37e73
I changed that to directly assign encoded bytes to destination (instead of concatenating them into one uint and write once), where I kept the endianness logic when I should not, endianness has no effect for ASCII characters:
runtime/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Base64Helper/Base64EncoderHelper.cs
Lines 766 to 784 in 745b776
Fixes #104283