This file contains hidden or 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
| // LinqPad BenchmarkDotNet script | |
| // Compares for-loop (indexer) vs foreach (struct enumerator) over List<T> | |
| // at sizes relevant to EntryDoor slab definition lists. | |
| // | |
| // Required NuGet: BenchmarkDotNet | |
| // | |
| // NOTE: Set the target framework and runtime in your LinqPad/project settings. | |
| void Main() | |
| { |
This file contains hidden or 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
| // run with: | |
| // dotnet run -c Release --framework net10.0 -- --filter * | |
| // * Summary * |
This file contains hidden or 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
| [MemoryDiagnoser] | |
| [GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)] | |
| [Config(typeof(IterationBenchmarks_for_vs_foreach_ValueType.IterationBenchmarksConfig))] | |
| public class IterationBenchmarks_for_vs_foreach_ValueType | |
| { | |
| [Params(1_000, 10_000, 50_000)] | |
| public int Count; | |
| private List<int> _listOfInt = null; | |
| private Consumer _consumer = null; |
This file contains hidden or 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
| [MemoryDiagnoser] | |
| public class DictionaryKeyLookupHitBenchmarks | |
| { | |
| private readonly Consumer _consumer = new Consumer(); | |
| private Guid[] _guidKeys = Array.Empty<Guid>(); | |
| private string[] _string20Keys = Array.Empty<string>(); | |
| private string[] _string50Keys = Array.Empty<string>(); | |
| private Dictionary<Guid, int> _guidDictionary = new Dictionary<Guid, int>(); |
This file contains hidden or 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
| [MemoryDiagnoser] | |
| [Config(typeof(DictionaryKeyAddBenchmarks.DictionaryKeyAddBenchmarksConfig))] | |
| public class DictionaryKeyAddBenchmarks | |
| { | |
| private readonly Consumer _consumer = new Consumer(); | |
| private Guid[] _guidKeys = Array.Empty<Guid>(); | |
| private string[] _string_20_Keys = Array.Empty<string>(); | |
| private string[] _string_50_Keys = Array.Empty<string>(); |
This file contains hidden or 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
| [MemoryDiagnoser] | |
| [GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)] | |
| [CategoriesColumn] | |
| [Config(typeof(IterationBenchmarks.IterationBenchmarksConfig))] | |
| public class IterationBenchmarks | |
| { | |
| [Params(1_000, 10_000, 50_000)] | |
| public int Count; | |
| private ArrayList _arrayList = null; |
This file contains hidden or 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
| [MemoryDiagnoser] | |
| [GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)] | |
| [CategoriesColumn] | |
| [Config(typeof(IterationBenchmarks.IterationBenchmarksConfig))] | |
| public class IterationBenchmarks | |
| { | |
| [Params(1_000, 10_000, 50_000)] | |
| public int Count; | |
| private ArrayList _arrayList = null; |
This file contains hidden or 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
| [MemoryDiagnoser] | |
| [GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByCategory)] | |
| [CategoriesColumn] | |
| [Config(typeof(IterationBenchmarks.IterationBenchmarksConfig))] | |
| public class IterationBenchmarks | |
| { | |
| [Params(1_000, 10_000, 50_000)] | |
| public int Count; | |
| private ArrayList _arrayList = null; |
This file contains hidden or 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.Collections; | |
| using System.Runtime.CompilerServices; | |
| using BenchmarkDotNet.Attributes; | |
| using BenchmarkDotNet.Columns; | |
| using BenchmarkDotNet.Configs; | |
| using BenchmarkDotNet.Engines; | |
| using BenchmarkDotNet.Running; | |
| [MemoryDiagnoser] |
This file contains hidden or 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.Collections; | |
| using System.Runtime.CompilerServices; | |
| using BenchmarkDotNet.Attributes; | |
| using BenchmarkDotNet.Columns; | |
| using BenchmarkDotNet.Configs; | |
| using BenchmarkDotNet.Engines; | |
| using BenchmarkDotNet.Running; | |
| [MemoryDiagnoser] |
NewerOlder