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 Buffer.BlockCopy with byte[] #1366

Conversation

Kaur-Parminder
Copy link
Contributor

This change is based on changes done dotnet/corefx@3ab3bd6. I have replaced Array.Copy wherever there is byte[]. Buffer.BlockCopy has less overhead than Array.Copy when copying byte[]s.

This change is based on changes done dotnet/corefx@3ab3bd6. I have replaced Array.Copy wherever there is byte[]. Buffer.BlockCopy has less overhead than Array.Copy when copying byte[]s.
@Wraith2
Copy link
Contributor

Wraith2 commented Oct 21, 2021

I don't object but I also don't think this will make any measurable difference to performance.

@Kaur-Parminder
Copy link
Contributor Author

I don't object but I also don't think this will make any measurable difference to performance.

It is debatable at many resources if there is performance difference or not. I have added this to diverge the difference between netfx and netcore and to be consistent across all files, responding to the comment #1337 (comment)

@cheenamalhotra cheenamalhotra added the ➕ Code Health Issues/PRs that are targeted to source code quality improvements. label Oct 25, 2021
@JRahnama JRahnama added this to the 5.0.0-preview1 milestone Dec 7, 2021
@JRahnama
Copy link
Contributor

working with bytes are more difficult than working with indexes and may cause debugging to be more complicated, but since the data is already in bytes no issue here. Looks good to me.

@DavoudEshtehari DavoudEshtehari merged commit 8202268 into dotnet:main Jan 26, 2022
@Kaur-Parminder Kaur-Parminder deleted the ReplaceArrayCopyWithBufferBlockCopy branch February 16, 2022 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
➕ Code Health Issues/PRs that are targeted to source code quality improvements.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants