From ea4329232cb373548a6f1e9c91eab8ac6b8bb877 Mon Sep 17 00:00:00 2001 From: Martin Strecker Date: Wed, 8 Jan 2025 13:22:31 +0100 Subject: [PATCH] Review --- rules/S1215/csharp/rule.adoc | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/rules/S1215/csharp/rule.adoc b/rules/S1215/csharp/rule.adoc index 3c216b7e076..4e749a942db 100644 --- a/rules/S1215/csharp/rule.adoc +++ b/rules/S1215/csharp/rule.adoc @@ -36,22 +36,20 @@ The benchmark below illustrates how invoking `GC.Collect()` can have opposite ef [options="header"] |=== -| Runtime | Collect | Mean | StdDev | Gen1 | Gen2 | Allocated -| .NET 9.0 | False | 659.2 ms | 15.69 ms | 21000.0000 | 6000.0000 | 205.95 MB -| .NET 9.0 | True | 888.8 ms | 15.34 ms | 21000.0000 | 7000.0000 | 205.95 MB -| | | | | | | -| .NET Framework 4.8.1 | False | 545.7 ms | 19.49 ms | 19000.0000 | 7000.0000 | 228.8 MB -| .NET Framework 4.8.1 | True | 484.8 ms | 11.79 ms | 19000.0000 | 7000.0000 | 228.8 MB +| Runtime | Collect | Mean | Standard Deviation | Allocated +| .NET 9.0 | False | 659.2 ms | 15.69 ms | 205.95 MB +| .NET 9.0 | True | 888.8 ms | 15.34 ms | 205.95 MB +| | | | | +| .NET Framework 4.8.1 | False | 545.7 ms | 19.49 ms | 228.8 MB +| .NET Framework 4.8.1 | True | 484.8 ms | 11.79 ms | 228.8 MB |=== ==== Glossary -* **Mean** Arithmetic mean of all measurements -* **StdDev** Standard deviation of all measurements -* **Gen1** GC Generation 1 collects per 1000 operations -* **Gen2** GC Generation 2 collects per 1000 operations -* **Allocated** Allocated memory per single operation (managed only, inclusive, 1KB = 1024B) -* **1 ms** 1 Millisecond (0.001 sec) +* Collect - if `True`, `GC.Collect()` is called in the middle of the allocation heavy `Benchmark()` method +* https://en.wikipedia.org/wiki/Arithmetic_mean[Mean] +* https://en.wikipedia.org/wiki/Standard_deviation[Standard Deviation] +* https://github.com/dotnet/BenchmarkDotNet/blob/master/docs/articles/configs/diagnosers.md[Allocated] The results were generated by running the following snippet with https://github.com/dotnet/BenchmarkDotNet[BenchmarkDotNet]: