NuGet Manager で BenchmarkDotNet を追加する。
属性をつけてそのまま実行すると次のエラーが出力される。
// Validating benchmarks: // * Assembly LINQPadQuery, Version=1.0.0.569, Culture=neutral, PublicKeyToken=null is located in temp. If you are running benchmarks from xUnit you need to disable shadow copy. It's not supported by design.
// * Assembly LINQPadQuery which defines benchmarks is non-optimized Benchmark was built without optimization enabled (most probably a DEBUG configuration). Please, build it in RELEASE. If you want to debug the benchmarks, please see https://benchmarkdotnet.org/articles/guides/troubleshooting.html#debugging-benchmarks. Please enable optimizations in your LINQPad. Go to Preferences -> Query and select "compile with /optimize+"
LINQPadの右下のボタンを押すと切り替えられる

もしくは、Preferences でコンパイルを release mode に設定するか、

コードの1行目に #LINQPad optimize+ を付け加える、でもOK。

使い方などはこの辺りを参考に。
【.NET/C#】BenchmarkDotNetを使って、メソッドのパフォーマンスを簡単に集計する #F# - Qiita