✅ Where does BenchmarkDotNet save my files?

I can run the following successfully but I cannot find where the files A.txt and B.txt are saved. Where are they saved?
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

BenchmarkRunner.Run<MyBenchmark>();


[MemoryDiagnoser]
public class MyBenchmark
{
Guid Id = Guid.NewGuid();

StreamWriter writerA = null!;
StreamWriter writerB = null!;

[GlobalSetup]
public void GlobalSetup()
{
writerA = new("A.txt");
writerB = new("B.txt");
}

[GlobalCleanup]
public void GlobalCleanup()
{
writerA?.Dispose();
writerB?.Dispose();
}

[Benchmark]
public async Task A() => await writerA.WriteLineAsync(Id.ToString());

[Benchmark]
public async Task B() => await writerB.WriteLineAsync(Id.ToString());
}
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

BenchmarkRunner.Run<MyBenchmark>();


[MemoryDiagnoser]
public class MyBenchmark
{
Guid Id = Guid.NewGuid();

StreamWriter writerA = null!;
StreamWriter writerB = null!;

[GlobalSetup]
public void GlobalSetup()
{
writerA = new("A.txt");
writerB = new("B.txt");
}

[GlobalCleanup]
public void GlobalCleanup()
{
writerA?.Dispose();
writerB?.Dispose();
}

[Benchmark]
public async Task A() => await writerA.WriteLineAsync(Id.ToString());

[Benchmark]
public async Task B() => await writerB.WriteLineAsync(Id.ToString());
}
6 Replies
jscarle
jscarle10mo ago
They are in a folder named BenchmarkDotNet.Artifacts\results inside the bin folder.
i like chatgpt
i like chatgptOP10mo ago
No. There are no A.txt and B.txt there.
jscarle
jscarle10mo ago
Its a single text file for the class., not per test.
i like chatgpt
i like chatgptOP10mo ago
Nothing.
i like chatgpt
i like chatgptOP10mo ago
No description
SinFluxx
SinFluxx10mo ago
try and chuck in Console.WriteLine(Path.GetFullPath("A.txt"); after it's created probably gets put in a temporary folder that gets cleaned up after the run
Want results from more Discord servers?
Add your server