diff --git a/src/benchmarks/micro/libraries/System.IO.FileSystem/Perf.File.cs b/src/benchmarks/micro/libraries/System.IO.FileSystem/Perf.File.cs index 859da2eb2d2..6b37f31dec2 100644 --- a/src/benchmarks/micro/libraries/System.IO.FileSystem/Perf.File.cs +++ b/src/benchmarks/micro/libraries/System.IO.FileSystem/Perf.File.cs @@ -143,6 +143,19 @@ public void CleanupReadAllBytes() public Task ReadAllBytesAsync(int size) => File.ReadAllBytesAsync(_filesToRead[size]); #endif + [GlobalSetup(Targets = new[] { nameof(ReadAllLines), "ReadAllLinesAsync" })] + public void SetupReadAllLines() + => File.WriteAllLines(_testFilePath = FileUtils.GetTestFilePath(), ValuesGenerator.ArrayOfStrings(count: 100, minLength: 20, maxLength: 80)); + + [Benchmark] + public string[] ReadAllLines() => File.ReadAllLines(_testFilePath); + +#if !NETFRAMEWORK + [BenchmarkCategory(Categories.NoWASM)] + [Benchmark] + public Task ReadAllLinesAsync() => File.ReadAllLinesAsync(_testFilePath); +#endif + [GlobalSetup(Targets = new[] { nameof(AppendAllLines), "AppendAllLinesAsync" })] public void SetupAppendAllLines() {