Skip to content

Commit 4c4275a

Browse files
benchmarks: switch runner to BenchmarkSwitcher for full CLI arg support
Use BenchmarkSwitcher.FromAssembly instead of custom argument parsing, so BenchmarkDotNet CLI options (--filter, --job short, --inProcess, etc.) work out of the box when running the benchmarks directly. Co-authored-by: Copilot <[email protected]>
1 parent e6f59b2 commit 4c4275a

1 file changed

Lines changed: 13 additions & 47 deletions

File tree

tests/FSharp.Control.AsyncSeq.Benchmarks/AsyncSeqBenchmarks.fs

Lines changed: 13 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -179,53 +179,19 @@ type AsyncSeqPipelineBenchmarks() =
179179
|> Async.RunSynchronously
180180
|> ignore
181181

182-
/// Entry point for running benchmarks
182+
/// Entry point for running benchmarks.
183+
/// Delegates directly to BenchmarkSwitcher so all BenchmarkDotNet CLI options
184+
/// (--filter, --job short, --exporters, etc.) work out of the box.
185+
/// Examples:
186+
/// dotnet run -c Release # run all
187+
/// dotnet run -c Release -- --filter '*Filter*' # specific class
188+
/// dotnet run -c Release -- --filter '*' --job short # quick smoke-run
183189
module AsyncSeqBenchmarkRunner =
184-
190+
185191
[<EntryPoint>]
186192
let Main args =
187-
printfn "AsyncSeq Performance Benchmarks"
188-
printfn "================================"
189-
printfn "Running comprehensive performance benchmarks to establish baseline metrics"
190-
printfn "and verify fixes for known performance issues (memory leaks, O(n²) patterns)."
191-
printfn ""
192-
193-
let result =
194-
match args |> Array.tryHead with
195-
| Some "core" ->
196-
printfn "Running Core Operations Benchmarks..."
197-
BenchmarkRunner.Run<AsyncSeqCoreBenchmarks>() |> ignore
198-
0
199-
| Some "append" ->
200-
printfn "Running Append Operations Benchmarks..."
201-
BenchmarkRunner.Run<AsyncSeqAppendBenchmarks>() |> ignore
202-
0
203-
| Some "builder" ->
204-
printfn "Running Builder Pattern Benchmarks..."
205-
BenchmarkRunner.Run<AsyncSeqBuilderBenchmarks>() |> ignore
206-
0
207-
| Some "filter-choose-fold" ->
208-
printfn "Running Filter/Choose/Fold Benchmarks..."
209-
BenchmarkRunner.Run<AsyncSeqFilterChooseFoldBenchmarks>() |> ignore
210-
0
211-
| Some "pipeline" ->
212-
printfn "Running Pipeline Composition Benchmarks..."
213-
BenchmarkRunner.Run<AsyncSeqPipelineBenchmarks>() |> ignore
214-
0
215-
| Some "all" | None ->
216-
printfn "Running All Benchmarks..."
217-
BenchmarkRunner.Run<AsyncSeqCoreBenchmarks>() |> ignore
218-
BenchmarkRunner.Run<AsyncSeqAppendBenchmarks>() |> ignore
219-
BenchmarkRunner.Run<AsyncSeqBuilderBenchmarks>() |> ignore
220-
BenchmarkRunner.Run<AsyncSeqFilterChooseFoldBenchmarks>() |> ignore
221-
BenchmarkRunner.Run<AsyncSeqPipelineBenchmarks>() |> ignore
222-
0
223-
| Some suite ->
224-
printfn "Unknown benchmark suite: %s" suite
225-
printfn "Available suites: core, append, builder, filter-choose-fold, pipeline, all"
226-
1
227-
228-
printfn ""
229-
printfn "Benchmarks completed. Results provide baseline performance metrics"
230-
printfn "for future performance improvements and regression detection."
231-
result
193+
BenchmarkSwitcher
194+
.FromAssembly(typeof<AsyncSeqCoreBenchmarks>.Assembly)
195+
.Run(args)
196+
|> ignore
197+
0

0 commit comments

Comments
 (0)