Method | Runtime | Mean | Ratio | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|
AutoClosure | .NET 6.0 | 6.131 ms | 1.00 | 203.1250 | - | - | 1,711 KB |
ParallelFor | .NET 6.0 | 1.850 ms | 0.30 | 265.6250 | - | - | 2,158 KB |
ParallelForeach | .NET 6.0 | 1.916 ms | 0.31 | 271.4844 | - | - | 2,221 KB |
SelfClosure | .NET 6.0 | 5.883 ms | 0.96 | 93.7500 | - | - | 774 KB |
AutoClosure | .NET Core 3.1 | 6.727 ms | 1.00 | 203.1250 | - | - | 1,713 KB |
ParallelFor | .NET Core 3.1 | 1.925 ms | 0.29 | 257.8125 | - | - | 2,108 KB |
ParallelForeach | .NET Core 3.1 | 2.015 ms | 0.30 | 265.6250 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private sealed class Closure<T> { | |
private readonly Action<T> _action; | |
private readonly Action _closure; | |
private T _value; | |
public Closure(Action<T> action) { | |
_action = action; | |
_closure = Execute; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ref struct ArrayEnumerator<T> | |
where T: struct | |
{ | |
private int _index; | |
private readonly int _length; | |
private readonly T[] _array; | |
[MethodImpl(MethodImplOptions.AggressiveInlining)] | |
public ArrayEnumerator(T[] array) | |
{ |
Method | Runtime | TaskCount | Mean | Ratio | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|
AutoClosure | .NET 6.0 | 10 | 6.252 ms | 1.00 | 203.1250 | - | - | 1,709 KB |
ParallelFor | .NET 6.0 | 10 | 1.891 ms | 0.30 | 263.6719 | - | - | 2,154 KB |
ParallelForeach | .NET 6.0 | 10 | 1.909 ms | 0.31 | 269.5313 | - | - | 2,220 KB |
SelfClosure | .NET 6.0 | 10 | 5.747 ms | 0.88 | 93.7500 | - | - | 773 KB |
AutoClosure | .NET Core 3.1 | 10 | 6.706 ms | 1.00 | 203.1250 | - | - | 1,710 KB |
ParallelFor | .NET Core 3.1 | 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Runtime.CompilerServices; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Jobs; | |
namespace Benchs.Tricks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Buffers; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Jobs; | |
namespace Benchs.Arrays; | |
[SimpleJob(RuntimeMoniker.Net60)] |
Method | Runtime | Count | Mean | Ratio | RatioSD | Gen 0 | Gen 1 | Allocated |
---|---|---|---|---|---|---|---|---|
Builder | .NET 6.0 | 5 | 49.91 ns | 0.89 | 0.03 | 0.0249 | - | 208 B |
BuilderWithCapacity | .NET 6.0 | 5 | 55.82 ns | 1.00 | 0.00 | 0.1310 | 0.0005 | 1,096 B |
CachedBuilder | .NET 6.0 | 5 | 19.95 ns | 0.36 | 0.00 | - | - | - |
ValueBuilder | .NET 6.0 | 5 | 40.94 ns | 0.73 | 0.01 | - | - | - |
Builder | .NET Core 3.1 | 5 | 50.78 ns | 0.87 | 0.01 | 0.0249 | - | 208 B |
BuilderWithCapacity | .NET Core 3.1 | 5 | 58.20 ns | 1.00 | 0.00 | 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Buffers; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Jobs; | |
namespace Storage.Benchmark; | |
[SimpleJob(RuntimeMoniker.Net60)] | |
[SimpleJob(RuntimeMoniker.NetCoreApp31)] | |
[SimpleJob(RuntimeMoniker.Net48)] | |
[MeanColumn] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Configs; | |
using BenchmarkDotNet.Jobs; | |
using Random = System.Random; | |
namespace Storage.Benchmark; | |
[SimpleJob(RuntimeMoniker.Net60)] | |
[SimpleJob(RuntimeMoniker.NetCoreApp31)] | |
[SimpleJob(RuntimeMoniker.Net48)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Jobs; | |
namespace Storage.Benchmark; | |
[SimpleJob(RuntimeMoniker.Net60)] | |
[SimpleJob(RuntimeMoniker.NetCoreApp31)] | |
[SimpleJob(RuntimeMoniker.Net48)] | |
[MeanColumn] | |
public class ArrayReadBenchmark |
OlderNewer