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

Adding sequential read as the file option in ReadAllBytes #40213

Merged
merged 1 commit into from
Jul 31, 2020

Conversation

RiskRunner0
Copy link
Contributor

Fixing #40001, adding Sequential Read file option for ReadAllBytes in File.cs.

@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@danmoseley
Copy link
Member

This seems reasonable/safe, we already use SequentialScan for other similar methods, and StreamReader/StreamWriter always use it (thus also File.ReadAllText, WriteAllText etc)

What about File.InternalWriteAllBytes, WriteAllTextAsync, and AppendAllTextAsync. Should those have it?

@RiskRunner0
Copy link
Contributor Author

I think that makes sense, I'd want to validate it with someone else though (relatively new to .NET contributing and internals) so cc: @jkotas thoughts?

@jkotas
Copy link
Member

jkotas commented Jul 31, 2020

What about File.InternalWriteAllBytes, WriteAllTextAsync, and AppendAllTextAsync. Should those have it?

https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea#caching-behavior says that FILE_FLAG_SEQUENTIAL_SCAN helps with reading. It does not say anything about writing.

@danmoseley
Copy link
Member

@jkotas, right but I see it's on StreamWriter even in .NET Framework.
https://source.dot.net/#System.Private.CoreLib/StreamWriter.cs,169

@jkotas
Copy link
Member

jkotas commented Jul 31, 2020

If we were do add it to the file writing helpers, I would like to see data that prove it helps and does not hurt.

@danmoseley
Copy link
Member

For sure. Anyway I think this change can go ahead as its.

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

@QueenCitySmitty Thank you!

@jkotas jkotas merged commit 5ddc873 into dotnet:master Jul 31, 2020
@RiskRunner0
Copy link
Contributor Author

@jkotas thank YOU for letting me contribute.. first time! :D

@danmoseley
Copy link
Member

@QueenCitySmitty you are welcome here. Would you be interested in another contribution? eg
up for grabs: https://github.com/dotnet/runtime/issues?q=is%3Aopen+is%3Aissue+label%3Aup-for-grabs+
easy: https://github.com/dotnet/runtime/issues?q=is%3Aopen+is%3Aissue+label%3Aeasy

anything marked milestone 5.0 would be even better.

@RiskRunner0
Copy link
Contributor Author

Found this one in Up for Grabs, going to keep poking there, thanks for the encouragement!

Jacksondr5 pushed a commit to Jacksondr5/runtime that referenced this pull request Aug 10, 2020
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants