How to select BenchmarkDotNet benchmark in the console at runtime

If you have a set of benchmarks and are looking to run different ones at different times you can manually modify your code to switch benchmarks like on line 9 below.

An easier approach might be to tell BenchmarkDotNet about all benchmarks in a particular assembly and then for you to choose which one you want to run from the console window at runtime. This is possible using the BenchmarkSwitcher class as shown below…

Click on the image for a larger view in a new window.

Leave a Reply

Your email address will not be published. Required fields are marked *