- Identify places, where we know the file size up-front. Example:
File.WriteAll*. File.Copy etc.
- Ensure that the given source code has benchmarks coverage in the performance repo (contribute new benchmarks).
- Change the source code to use the new
FileStream ctor that allows for specifying allocationSize and specify the exact value (or estimation as OS is smart enough to shrink the file (when it's closed) if it was too much).
- Compare before vs after. If there is a visible performance or reliability gain, contribute the change to dotnet/runtime.
Since #51111 has not been merged yet, please use it for measurements.
File.WriteAll*.File.Copyetc.FileStreamctor that allows for specifyingallocationSizeand specify the exact value (or estimation as OS is smart enough to shrink the file (when it's closed) if it was too much).Since #51111 has not been merged yet, please use it for measurements.