You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<ahref="#learn-more-about-benchmarking">Learn more about benchmarking</a>
26
-
</h3>
25
+
</div>
27
26
28
27
**BenchmarkDotNet** helps you to transform methods into benchmarks, track their performance, and share reproducible measurement experiments.
29
28
It's no harder than writing unit tests!
30
29
Under the hood, it performs a lot of [magic](#automation) that guarantees [reliable and precise](#reliability) results thanks to the [perfolizer](https://github.com/AndreyAkinshin/perfolizer) statistical engine.
31
30
BenchmarkDotNet protects you from popular benchmarking mistakes and warns you if something is wrong with your benchmark design or obtained measurements.
32
31
The results are presented in a [user-friendly](#friendliness) form that highlights all the important facts about your experiment.
33
-
The library is adopted by [16500+ GitHub projects](#who-uses-benchmarkdotnet) including .NET Runtime and supported by the [.NET Foundation](https://dotnetfoundation.org).
32
+
The library is adopted by [16500+ GitHub projects](#who-uses-benchmarkdotnet) including .NET Runtime.
34
33
35
-
It's [easy](#simplicity) to start writing benchmarks, check out an example
34
+
It's [easy](#simplicity) to start writing benchmarks, check out the following example
36
35
(copy-pastable version is [here](https://benchmarkdotnet.org/articles/guides/getting-started.html)):
37
36
38
37
```cs
@@ -106,7 +105,7 @@ Intel Core i7-7700K CPU 4.20GHz (Kaby Lake), 1 CPU, 8 logical and 4 physical cor
106
105
107
106
The measured data can be exported to different formats (md, html, csv, xml, json, etc.) including plots:
@@ -128,7 +127,7 @@ For example, if you want to [parameterize](https://benchmarkdotnet.org/articles/
128
127
mark a field or a property with `[Params(1, 2, 3)]`: BenchmarkDotNet will enumerate all of the specified values
129
128
and run benchmarks for each case.
130
129
If you want to compare benchmarks with each other,
131
-
mark one of the benchmark as the [baseline](https://benchmarkdotnet.org/articles/features/baselines.html)
130
+
mark one of the benchmarks as the [baseline](https://benchmarkdotnet.org/articles/features/baselines.html)
132
131
via `[Benchmark(Baseline = true)]`: BenchmarkDotNet will compare it with all of the other benchmarks.
133
132
If you want to compare performance in different environments, use [jobs](https://benchmarkdotnet.org/articles/configs/jobs.html).
134
133
For example, you can run all the benchmarks on .NET Core 3.0 and Mono via
@@ -158,12 +157,12 @@ If you prefer command-line experience, you can configure your benchmarks via
158
157
159
158
Reliable benchmarks always include a lot of boilerplate code.
160
159
161
-
Let's think about what should you do in a typical case.
160
+
Let's think about what you should do in a typical case.
162
161
First, you should perform a pilot experiment and determine the best number of method invocations.
163
162
Next, you should execute several warm-up iterations and ensure that your benchmark achieved a steady state.
164
163
After that, you should execute the main iterations and calculate some basic statistics.
165
-
If you calculate some values in your benchmark, you should use it somehow to prevent the dead code elimination.
166
-
If you use loops, you should care about an effect of the loop unrolling on your results
164
+
If you calculate some values in your benchmark, you should use it somehow to prevent dead code elimination.
165
+
If you use loops, you should care about the effect of the loop unrolling on your results
167
166
(which may depend on the processor architecture).
168
167
Once you get results, you should check for some special properties of the obtained performance distribution
169
168
like multimodality or extremely high outliers.
@@ -174,7 +173,7 @@ If you write this code from scratch, it's easy to make a mistake and spoil your
174
173
Note that it's a shortened version of the full checklist that you should follow during benchmarking:
175
174
there are a lot of additional hidden pitfalls that should be handled appropriately.
176
175
Fortunately, you shouldn't worry about it because
177
-
BenchmarkDotNet [will do](https://benchmarkdotnet.org/articles/guides/how-it-works.html) this boring and time-consuming stuff for you.
176
+
BenchmarkDotNet [will perform](https://benchmarkdotnet.org/articles/guides/how-it-works.html) this boring and time-consuming stuff for you.
178
177
179
178
Moreover, the library can help you with some advanced tasks that you may want to perform during the investigation.
180
179
For example,
@@ -193,10 +192,10 @@ You shouldn't worry about the perfect number of method invocation, the number of
193
192
So, you shouldn't use any magic numbers (like "We should perform 100 iterations here"),
194
193
the library will do it for you based on the values of statistical metrics.
195
194
196
-
BenchmarkDotNet also prevents benchmarking of non-optimized assemblies that was built using DEBUG mode because
195
+
BenchmarkDotNet also prevents benchmarking of non-optimized assemblies that were built using DEBUG mode because
197
196
the corresponding results will be unreliable.
198
-
It will print a warning you if you have an attached debugger,
199
-
if you use hypervisor (HyperV, VMware, VirtualBox),
197
+
The library will print a warning if you have an attached debugger,
198
+
if you use a hypervisor (HyperV, VMware, VirtualBox),
200
199
or if you have any other problems with the current environment.
201
200
202
201
During 6+ years of development, we faced dozens of different problems that may spoil your measurements.
@@ -224,7 +223,7 @@ In this case, you can scroll the results up and check out ASCII-style histograms
224
223
or generate beautiful png plots using `[RPlotExporter]`.
225
224
226
225
BenchmarkDotNet doesn't overload you with data; it shows only the essential information depending on your results:
227
-
it allows you to keep summary small for primitive cases and extend it only for the complicated cases.
226
+
it allows you to keep the summary small for primitive cases and extend it only for complicated cases.
228
227
Of course, you can request any additional statistics and visualizations manually.
229
228
If you don't customize the summary view,
230
229
the default presentation will be as much user-friendly as possible. :)
@@ -270,7 +269,7 @@ BenchmarkDotNet is already adopted by more than [16500+](https://github.com/dotn
270
269
## Learn more about benchmarking
271
270
272
271
BenchmarkDotNet is not a silver bullet that magically makes all of your benchmarks correct and analyzes the measurements for you.
273
-
Even if you use this library, you still should know how to design the benchmark experiments and how to make correct conclusions based on the raw data.
272
+
Even if you use this library, you still should know how to design benchmark experiments and how to make correct conclusions based on the raw data.
274
273
If you want to know more about benchmarking methodology and good practices,
275
274
it's recommended to read a book by Andrey Akinshin (the BenchmarkDotNet project lead): ["Pro .NET Benchmarking"](https://aakinshin.net/prodotnetbenchmarking/).
276
275
Use this in-depth guide to correctly design benchmarks, measure key performance metrics of .NET applications, and analyze results.
@@ -287,11 +286,11 @@ You will avoid common pitfalls, control the accuracy of your measurements, and i
287
286
288
287
| Build server | Platform | Build status |
289
288
|--------------|----------|--------------|
290
-
| Azure Pipelines | Windows |[](https://dev.azure.com/dotnet/BenchmarkDotNet/_build/latest?definitionId=55)|
| AppVeyor | Windows |[](https://ci.appveyor.com/project/dotnetfoundation/benchmarkdotnet/branch/master)|
0 commit comments