Open Youssef1313 opened 2 months ago
Actually, just came across this today - we need to benchmark with a native database ORM (Realm), which requires that its instance is created on the same thread that runs the code. This fails with benchmarkdotnet as-is right now.
Actually, just came across this today - we need to benchmark with a native database ORM (Realm), which requires that its instance is created on the same thread that runs the code. This fails with benchmarkdotnet as-is right now.
Can't you just set it up in [GlobalSetup]
(and tear it down in [GlobalCleanup]
)?
This fails with benchmarkdotnet as-is right now.
With the default toolchain no threads are being created and every benchmark is executed in a dedicated, standalone process.
https://github.com/dotnet/BenchmarkDotNet/blob/01d9b7889e13cf756068985275a3997217e4a102/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitExecutor.cs#L59
Currently, benchmarks always run on background thread. It would be great if a new Toolchain and Executor are run on the same thread, or a property is added to existing toolchains/executors to control whether a background thread is created or not.