Benchmark of Collection Searching (TryGetValue method) in terms of Allocation Size


BenchmarkDotNet v0.13.12, Windows 11 (10.0.22631.3007/23H2/2023Update/SunValley3)
AMD Ryzen 7 5800H with Radeon Graphics, 1 CPU, 16 logical and 8 physical cores
.NET SDK 8.0.101
  [Host]   : .NET 8.0.1 (8.0.123.58001), X64 RyuJIT AVX2
  ShortRun : .NET 8.0.1 (8.0.123.58001), X64 RyuJIT AVX2

Job=ShortRun  IterationCount=3  LaunchCount=1  
WarmupCount=3

Comparison: Allocated

MethodBig OLengthExistedInt32StringStructIntsClassIntsRecordStructIntsRecordClassIntsStructStringsClassStringsRecordStructStringsRecordClassStrings
List (Sorted + BinarySearch) O(log(N)) 1000 False - - - - - - - - - -
Array (Sorted + BinarySearch) O(log(N)) 1000 False - - - - - - - - - -
ImmutableArray (Sorted + BinarySearch) O(log(N)) 1000 False - - - - - - - - - -
SortedSet O(log(N)) 1000 False - - - - - - - - - -
ImmutableSortedSet O(log(N)) 1000 False - - - - - - - - - -
ImmutableSortedDictionary O(log(N)) 1000 False - - - - - - - - - -
ImmutableList (Sorted + BinarySearch) O(log(N)) 1000 False - - - - - - - - - -
FrozenDictionary O(1) 1000 False - - 32 B - - - 40 B - - -
Dictionary O(1) 1000 False - - 32 B - - - 40 B - - -
HashSet O(1) 1000 False - - 32 B - - - 40 B - - -
FrozenSet O(1) 1000 False - - 32 B - - - 40 B - - -
ReadOnlyDictionary O(1) 1000 False - - 32 B - - - 40 B - - -
ImmutableHashSet O(1) 1000 False - - 32 B - - - 40 B - - -
ImmutableDictionary O(1) 1000 False - - 32 B - - - 40 B - - -
SortedList O(log(N)) 1000 False - - 32 B - 32 B - 40 B - 40 B -
SortedDictionary O(log(N)) 1000 False - - 32 B - 32 B - 40 B - 40 B -
ReadOnlyCollection O(N) 1000 False - - 64000 B - - - 128000 B - - -
ImmutableArray O(N) 1000 False - - 64000 B - - - 128001 B - - -
List O(N) 1000 False - - 64000 B - - - 128001 B - - -
Array O(N) 1000 False - - 64000 B - - - 128001 B - - -
MethodBig OLengthExistedInt32StringStructIntsClassIntsRecordStructIntsRecordClassIntsStructStringsClassStringsRecordStructStringsRecordClassStrings
List (Sorted + BinarySearch) O(log(N)) 1000 True - - - - - - - - - -
ImmutableArray (Sorted + BinarySearch) O(log(N)) 1000 True - - - - - - - - - -
Array (Sorted + BinarySearch) O(log(N)) 1000 True - - - - - - - - - -
ImmutableSortedSet O(log(N)) 1000 True - - - - - - - - - -
SortedSet O(log(N)) 1000 True - - - - - - - - - -
ImmutableSortedDictionary O(log(N)) 1000 True - - - - - - - - - -
ImmutableList (Sorted + BinarySearch) O(log(N)) 1000 True - - - - - - - - - -
SortedList O(log(N)) 1000 True - - 32 B - 32 B - 40 B - 40 B -
SortedDictionary O(log(N)) 1000 True - - 32 B - 32 B - 40 B - 40 B -
FrozenDictionary O(1) 1000 True - - 96 B - - - 168 B - - -
Dictionary O(1) 1000 True - - 96 B - - - 168 B - - -
HashSet O(1) 1000 True - - 96 B - - - 168 B - - -
ReadOnlyDictionary O(1) 1000 True - - 96 B - - - 168 B - - -
FrozenSet O(1) 1000 True - - 96 B - - - 168 B - - -
ImmutableHashSet O(1) 1000 True - - 96 B - - - 168 B - - -
ImmutableDictionary O(1) 1000 True - - 96 B - - - 168 B - - -
ReadOnlyCollection O(N) 1000 True - - 30901 B - - - 61441 B - - -
List O(N) 1000 True - - 30901 B - - - 61441 B - - -
Array O(N) 1000 True - - 30901 B - - - 61441 B - - -
ImmutableArray O(N) 1000 True - - 30901 B - - - 61441 B - - -
Powered by https://github.com/mjebrahimi/BenchmarkDotNetVisualizer