I'm playing with the performance chapter from the (excellent) book Stylish F#: Crafting Elegant Functional Code for .NET and .NET Core.
Here is a basic BenchmarkDotNet benchmark:
open BenchmarkDotNet.Running
open BenchmarkDotNet.Attributes
module Dummy =
let slowFunction () =
System.Threading.Thread.Sleep 100
99
let fastFunction () =
System.Threading.Thread.Sleep 10
99
module Harness =
[<MemoryDiagnoser>]
type Harness() =
[<Benchmark>]
member _.Old() = Dummy.slowFunction ()
[<Benchmark>]
member _.New() = Dummy.fastFunction ()
[<EntryPoint>]
let run _ =
BenchmarkRunner.Run<Harness.Harness>()
|> printfn "%A"
0
On my WSL2 Linux Ubuntu 20.04, after dotnet -c release
(I truncated the end):
// Validating benchmarks:
// ***** BenchmarkRunner: Start *****
// ***** Found 2 benchmark(s) in total *****
// ***** Building 1 exe(s) in Parallel: Start *****
// ***** Done, took 00:00:00 (0.13 sec) *****
// Found 2 benchmarks:
// Harness.Old: DefaultJob
// Harness.New: DefaultJob
// Generate Exception: Access to the path '/mnt/c/DumpStack.log.tmp' is denied.
// BenchmarkDotNet has failed to build the auto-generated boilerplate code.
// It can be found in /mnt/c/data/dev/fsharp-lab/Stylish-FSharp6/bin/release/net6.0/c456e559-bdf2-4a24-858d-b423379f42c9
// Please follow the troubleshooting guide: https://benchmarkdotnet.org/articles/guides/troubleshooting.html
// ***** BenchmarkRunner: Finish *****
My understanding is that neither my WSL2 user (nor root) can read the Dump stack logging from Windows 11:
- => Is it possible to grant access to these files (at the expense of lower security, I guess)?
- => Is BenchmarkDotNet even supposed to work on WSL2?