You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 26ce1d9
Browse filesBrowse the repository at this point in the historyBrowse files
Fastest way to read a text file: retarget net10.0, add async reads, re-run benchmark
- Both projects net7.0 -> net10.0; Nullable enabled on the sample project.
- BenchmarkDotNet 0.13.7 -> 0.15.8.
- Test packages to current: Microsoft.NET.Test.Sdk 18.9.0, xunit 2.9.3,
xunit.runner.visualstudio 4.0.0, coverlet.collector 10.0.1. This clears
NU1903 (Newtonsoft.Json 9.0.1 came in transitively through the old test SDK).
- Primary constructor on WaysToReadATextFileInCsharp.
- UseBufferedStreamObjectWithNoFileStreamBuffer moves to the FileStreamOptions
overload. FileStreamOptions.BufferSize documents "0 or 1 means that buffering
should be disabled"; the five-argument FileStream constructor documents its
bufferSize as greater than zero and throws on zero. Same behaviour, but the
section now stands on the API whose docs state what it teaches.
- Three async reads with matching benchmarks and tests:
UseFileReadAllTextAsync, UseFileReadLinesAsync, UseStreamReaderReadToEndAsync.
The StreamReader one is built over a FileStream with FileOptions.Asynchronous
rather than the path-taking constructor, which does not set that flag and so
fakes async file access on the thread pool.
- Benchmark file resolved with AppContext.BaseDirectory and copied to the output
directory, replacing a six-level Directory.GetParent walk tied to one layout.
Copy file name to clipboardExpand all lines: files-csharp/FastestWayToReadATextFileInCsharp/FastestWayToReadATextFileInCsharp/FastestWayToReadATextFileInCsharp.csproj
Copy file name to clipboardExpand all lines: files-csharp/FastestWayToReadATextFileInCsharp/FastestWayToReadATextFileInCsharp/WaysToReadATextFileInCsharp.cs
Copy file name to clipboardExpand all lines: files-csharp/FastestWayToReadATextFileInCsharp/FastestWayToReadATextFileInCsharp/WaysToReadATextFileInCsharpBenchmark.cs
0 commit comments