Benchmark of Collection Initializing in terms of Allocation Size
BenchmarkDotNet v0.13.11, Windows 11 (10.0.22631.2861/23H2/2023Update/SunValley3)
AMD Ryzen 7 5800H with Radeon Graphics, 1 CPU, 16 logical and 8 physical cores
.NET SDK 8.0.100
[Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2
ShortRun : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2
Job=ShortRun IterationCount=3 LaunchCount=1
WarmupCount=3
Comparison: Allocated
Method | Length | Sorted | Int32 | String | StructInts | ClassInts | RecordStructInts | RecordClassInts | StructStrings | ClassStrings | RecordStructStrings | RecordClassStrings |
Array |
10000 |
False |
39.09 KB |
78.15 KB |
117.22 KB |
78.15 KB |
117.22 KB |
78.15 KB |
234.42 KB |
78.15 KB |
234.42 KB |
78.15 KB |
Array (Sorted) |
10000 |
False |
39.09 KB |
78.15 KB |
117.22 KB |
78.15 KB |
117.22 KB |
78.15 KB |
234.42 KB |
78.15 KB |
234.42 KB |
78.15 KB |
ImmutableArray |
10000 |
False |
39.09 KB |
78.15 KB |
117.22 KB |
78.15 KB |
117.22 KB |
78.15 KB |
234.42 KB |
78.15 KB |
234.42 KB |
78.15 KB |
ReadOnlyCollection |
10000 |
False |
39.11 KB |
78.17 KB |
117.25 KB |
78.17 KB |
117.25 KB |
78.17 KB |
234.45 KB |
78.17 KB |
234.45 KB |
78.17 KB |
List |
10000 |
False |
39.12 KB |
78.18 KB |
117.25 KB |
78.18 KB |
117.25 KB |
78.18 KB |
234.45 KB |
78.18 KB |
234.45 KB |
78.18 KB |
List (Sorted) |
10000 |
False |
39.12 KB |
78.18 KB |
117.25 KB |
78.18 KB |
117.25 KB |
78.18 KB |
234.46 KB |
78.18 KB |
234.46 KB |
78.18 KB |
ImmutableArray (Sorted) |
10000 |
False |
78.17 KB |
156.3 KB |
234.45 KB |
156.3 KB |
234.45 KB |
156.3 KB |
468.85 KB |
156.3 KB |
468.85 KB |
156.3 KB |
HashSet |
10000 |
False |
158.02 KB |
197.49 KB |
549.46 KB |
197.49 KB |
236.96 KB |
197.49 KB |
745.99 KB |
197.49 KB |
355.36 KB |
197.49 KB |
Dictionary |
10000 |
False |
197.47 KB |
276.41 KB |
588.91 KB |
276.41 KB |
276.41 KB |
276.41 KB |
824.91 KB |
276.41 KB |
434.28 KB |
276.41 KB |
ReadOnlyDictionary |
10000 |
False |
197.51 KB |
276.45 KB |
588.95 KB |
276.45 KB |
276.45 KB |
276.45 KB |
824.95 KB |
276.45 KB |
434.32 KB |
276.45 KB |
SortedList |
10000 |
False |
246.45 KB |
364.46 KB |
716.03 KB |
364.46 KB |
403.53 KB |
364.46 KB |
1069.23 KB |
364.46 KB |
678.61 KB |
364.46 KB |
FrozenSet |
10000 |
False |
394.34 KB |
945.63 KB |
1490.77 KB |
748.11 KB |
865.77 KB |
748.11 KB |
1999.95 KB |
748.11 KB |
1219.54 KB |
748.11 KB |
SortedSet |
10000 |
False |
429.76 KB |
546.95 KB |
586.02 KB |
546.95 KB |
586.02 KB |
546.95 KB |
859.47 KB |
546.95 KB |
859.47 KB |
546.95 KB |
ImmutableList |
10000 |
False |
468.8 KB |
468.8 KB |
546.92 KB |
468.8 KB |
546.92 KB |
468.8 KB |
625.05 KB |
468.8 KB |
625.05 KB |
468.8 KB |
LinkedList |
10000 |
False |
468.82 KB |
468.82 KB |
546.95 KB |
468.82 KB |
546.95 KB |
468.82 KB |
625.07 KB |
468.82 KB |
625.07 KB |
468.82 KB |
ImmutableSortedSet |
10000 |
False |
507.92 KB |
546.99 KB |
664.18 KB |
546.98 KB |
664.18 KB |
546.99 KB |
859.51 KB |
546.99 KB |
859.51 KB |
546.99 KB |
FrozenDictionary |
10000 |
False |
521.73 KB |
1044.19 KB |
1579.07 KB |
914.99 KB |
954.07 KB |
914.99 KB |
2166.84 KB |
914.99 KB |
1387.48 KB |
914.99 KB |
ImmutableHashSet |
10000 |
False |
546.96 KB |
546.96 KB |
937.58 KB |
546.96 KB |
625.08 KB |
546.96 KB |
1093.83 KB |
546.96 KB |
703.21 KB |
546.96 KB |
ImmutableDictionary |
10000 |
False |
547.06 KB |
625.19 KB |
937.69 KB |
625.19 KB |
625.19 KB |
625.19 KB |
1172.08 KB |
625.19 KB |
781.46 KB |
625.19 KB |
SortedDictionary |
10000 |
False |
666.38 KB |
823.45 KB |
1135.95 KB |
823.45 KB |
823.45 KB |
823.45 KB |
1528.21 KB |
823.45 KB |
1137.59 KB |
823.45 KB |
ImmutableSortedDictionary |
10000 |
False |
938.21 KB |
1172.61 KB |
1797.6 KB |
1172.6 KB |
1797.6 KB |
1172.6 KB |
2422.64 KB |
1172.61 KB |
2422.64 KB |
1172.61 KB |
ImmutableList (Sorted) |
10000 |
False |
976.68 KB |
1015.75 KB |
1211.07 KB |
1015.74 KB |
1211.07 KB |
1015.74 KB |
1484.52 KB |
1015.75 KB |
1484.52 KB |
1015.75 KB |
Method | Length | Sorted | Int32 | String | StructInts | ClassInts | RecordStructInts | RecordClassInts | StructStrings | ClassStrings | RecordStructStrings | RecordClassStrings |
Array |
10000 |
True |
39.09 KB |
78.15 KB |
117.22 KB |
78.15 KB |
117.22 KB |
78.15 KB |
234.42 KB |
78.15 KB |
234.42 KB |
78.15 KB |
Array (Sorted) |
10000 |
True |
39.09 KB |
78.15 KB |
117.22 KB |
78.15 KB |
117.22 KB |
78.15 KB |
234.42 KB |
78.15 KB |
234.42 KB |
78.15 KB |
ImmutableArray |
10000 |
True |
39.09 KB |
78.15 KB |
117.22 KB |
78.15 KB |
117.22 KB |
78.15 KB |
234.42 KB |
78.15 KB |
234.42 KB |
78.15 KB |
ImmutableArray (Sorted) |
10000 |
True |
39.09 KB |
78.15 KB |
117.22 KB |
78.15 KB |
117.22 KB |
78.15 KB |
234.42 KB |
78.15 KB |
234.42 KB |
78.15 KB |
ReadOnlyCollection |
10000 |
True |
39.11 KB |
78.17 KB |
117.25 KB |
78.17 KB |
117.25 KB |
78.17 KB |
234.45 KB |
78.17 KB |
234.45 KB |
78.17 KB |
List |
10000 |
True |
39.12 KB |
78.18 KB |
117.25 KB |
78.18 KB |
117.25 KB |
78.18 KB |
234.45 KB |
78.18 KB |
234.45 KB |
78.18 KB |
List (Sorted) |
10000 |
True |
39.12 KB |
78.18 KB |
117.25 KB |
78.18 KB |
117.25 KB |
78.18 KB |
234.45 KB |
78.18 KB |
234.45 KB |
78.18 KB |
HashSet |
10000 |
True |
158.02 KB |
197.49 KB |
549.46 KB |
197.49 KB |
236.96 KB |
197.49 KB |
745.99 KB |
197.49 KB |
355.36 KB |
197.49 KB |
Dictionary |
10000 |
True |
197.47 KB |
276.41 KB |
588.91 KB |
276.41 KB |
276.41 KB |
276.41 KB |
824.91 KB |
276.41 KB |
434.28 KB |
276.41 KB |
ReadOnlyDictionary |
10000 |
True |
197.51 KB |
276.45 KB |
588.95 KB |
276.45 KB |
276.45 KB |
276.45 KB |
824.95 KB |
276.45 KB |
434.32 KB |
276.45 KB |
SortedList |
10000 |
True |
246.45 KB |
364.46 KB |
716.03 KB |
364.46 KB |
403.53 KB |
364.46 KB |
1069.23 KB |
364.46 KB |
678.61 KB |
364.46 KB |
FrozenSet |
10000 |
True |
394.34 KB |
945.63 KB |
1490.77 KB |
748.11 KB |
865.77 KB |
748.11 KB |
1999.93 KB |
748.11 KB |
1219.77 KB |
748.11 KB |
SortedSet |
10000 |
True |
429.76 KB |
546.95 KB |
586.02 KB |
546.95 KB |
586.02 KB |
546.95 KB |
859.47 KB |
546.95 KB |
859.47 KB |
546.95 KB |
ImmutableList |
10000 |
True |
468.8 KB |
468.8 KB |
546.92 KB |
468.8 KB |
546.92 KB |
468.8 KB |
625.05 KB |
468.8 KB |
625.05 KB |
468.8 KB |
LinkedList |
10000 |
True |
468.82 KB |
468.82 KB |
546.95 KB |
468.82 KB |
546.95 KB |
468.82 KB |
625.07 KB |
468.82 KB |
625.07 KB |
468.82 KB |
ImmutableSortedSet |
10000 |
True |
507.92 KB |
546.99 KB |
664.18 KB |
546.98 KB |
664.18 KB |
546.98 KB |
859.51 KB |
546.99 KB |
859.51 KB |
546.99 KB |
FrozenDictionary |
10000 |
True |
521.73 KB |
1044.19 KB |
1579.07 KB |
914.99 KB |
954.07 KB |
914.99 KB |
2166.79 KB |
914.99 KB |
1385.44 KB |
914.99 KB |
ImmutableHashSet |
10000 |
True |
546.95 KB |
546.96 KB |
937.58 KB |
546.96 KB |
625.08 KB |
546.96 KB |
1093.83 KB |
546.96 KB |
703.21 KB |
546.96 KB |
ImmutableDictionary |
10000 |
True |
547.06 KB |
625.19 KB |
937.69 KB |
625.19 KB |
625.19 KB |
625.19 KB |
1172.08 KB |
625.19 KB |
781.46 KB |
625.19 KB |
SortedDictionary |
10000 |
True |
666.38 KB |
823.45 KB |
1135.95 KB |
823.45 KB |
823.45 KB |
823.45 KB |
1528.21 KB |
823.45 KB |
1137.59 KB |
823.45 KB |
ImmutableSortedDictionary |
10000 |
True |
938.2 KB |
1172.61 KB |
1797.6 KB |
1172.6 KB |
1797.6 KB |
1172.6 KB |
2422.64 KB |
1172.61 KB |
2422.64 KB |
1172.61 KB |
ImmutableList (Sorted) |
10000 |
True |
976.68 KB |
1015.75 KB |
1211.07 KB |
1015.74 KB |
1211.07 KB |
1015.74 KB |
1484.52 KB |
1015.75 KB |
1484.52 KB |
1015.75 KB |
Method | Length | Sorted | Int32 | String | StructInts | ClassInts | RecordStructInts | RecordClassInts | StructStrings | ClassStrings | RecordStructStrings | RecordClassStrings |
ImmutableArray |
1000000 |
False |
3906.32 KB |
7812.54 KB |
11718.89 KB |
7812.54 KB |
11718.88 KB |
7812.56 KB |
23437.59 KB |
7812.54 KB |
23437.59 KB |
7812.54 KB |
Array |
1000000 |
False |
3906.32 KB |
7812.55 KB |
11718.89 KB |
7812.56 KB |
11718.89 KB |
7812.56 KB |
23437.59 KB |
7812.54 KB |
23437.59 KB |
7812.54 KB |
ReadOnlyCollection |
1000000 |
False |
3906.34 KB |
7812.93 KB |
11718.91 KB |
7813.05 KB |
11718.91 KB |
7813.11 KB |
23437.61 KB |
7812.57 KB |
23437.61 KB |
7812.57 KB |
List |
1000000 |
False |
3906.35 KB |
7812.97 KB |
11718.92 KB |
7813.07 KB |
11718.92 KB |
7813.1 KB |
23437.62 KB |
7812.57 KB |
23437.62 KB |
7812.57 KB |
Array (Sorted) |
1000000 |
False |
3906.4 KB |
7812.91 KB |
11718.9 KB |
7812.65 KB |
11718.9 KB |
7812.56 KB |
23437.91 KB |
7812.91 KB |
23437.91 KB |
7812.91 KB |
List (Sorted) |
1000000 |
False |
3906.44 KB |
7812.95 KB |
11718.93 KB |
7812.68 KB |
11718.93 KB |
7812.59 KB |
23437.95 KB |
7812.95 KB |
23437.95 KB |
7812.95 KB |
ImmutableArray (Sorted) |
1000000 |
False |
7812.77 KB |
15625.44 KB |
23437.67 KB |
15625.18 KB |
23437.67 KB |
15625.27 KB |
46875.44 KB |
15625.44 KB |
46875.44 KB |
15625.44 KB |
HashSet |
1000000 |
False |
18168.91 KB |
22710.99 KB |
58517.29 KB |
22712.03 KB |
27251.66 KB |
22712.03 KB |
79957.29 KB |
22708.95 KB |
40876.04 KB |
22708.95 KB |
Dictionary |
1000000 |
False |
22709.02 KB |
31792.54 KB |
63058.68 KB |
31792.52 KB |
31792.5 KB |
31792.49 KB |
89040.86 KB |
31792.43 KB |
49959.52 KB |
31792.37 KB |
ReadOnlyDictionary |
1000000 |
False |
22709.06 KB |
31792.55 KB |
63058.09 KB |
31792.58 KB |
31792.54 KB |
31792.56 KB |
89039.28 KB |
31792.41 KB |
49959.55 KB |
31792.47 KB |
SortedList |
1000000 |
False |
27591.96 KB |
40590.23 KB |
75753.25 KB |
40585.89 KB |
44488.06 KB |
40585.89 KB |
113453.33 KB |
40581.96 KB |
74373.95 KB |
40581.68 KB |
SortedSet |
1000000 |
False |
42969.5 KB |
54687.96 KB |
58594.55 KB |
54687.98 KB |
58594.55 KB |
54687.95 KB |
85937.96 KB |
54687.96 KB |
85937.68 KB |
54687.96 KB |
FrozenSet |
1000000 |
False |
44677.32 KB |
105720.5 KB |
157880.99 KB |
83013.53 KB |
95365.64 KB |
83011.54 KB |
210573.43 KB |
83011.25 KB |
132428.42 KB |
83011.25 KB |
ImmutableList |
1000000 |
False |
46875.68 KB |
46875.28 KB |
54688.2 KB |
46875.37 KB |
54688.2 KB |
46875.37 KB |
62500.18 KB |
46875.13 KB |
62500.23 KB |
46875.13 KB |
LinkedList |
1000000 |
False |
46875.79 KB |
46875.44 KB |
54688.35 KB |
46875.5 KB |
54688.28 KB |
46875.44 KB |
62500.32 KB |
46875.23 KB |
62500.26 KB |
46875.19 KB |
ImmutableSortedSet |
1000000 |
False |
50783.16 KB |
54687.72 KB |
66406.88 KB |
54688.02 KB |
66406.89 KB |
54688.03 KB |
85938 KB |
54688 KB |
85938 KB |
54688 KB |
ImmutableHashSet |
1000000 |
False |
54691.8 KB |
54693.22 KB |
93794.8 KB |
54699.92 KB |
62507.03 KB |
54693.65 KB |
109426.2 KB |
54693.13 KB |
70321.09 KB |
54693.03 KB |
ImmutableDictionary |
1000000 |
False |
54698.62 KB |
62510.23 KB |
93779.76 KB |
62508.02 KB |
62513.92 KB |
62512.82 KB |
117223.37 KB |
62506.59 KB |
78133.21 KB |
62506.65 KB |
FrozenDictionary |
1000000 |
False |
58008.48 KB |
116757.2 KB |
167306.29 KB |
100884.11 KB |
104790.37 KB |
100883.94 KB |
228443.2 KB |
100884.14 KB |
150301.13 KB |
100884 KB |
SortedDictionary |
1000000 |
False |
69596.26 KB |
86480.41 KB |
117746.27 KB |
86492.76 KB |
86481.09 KB |
86481.55 KB |
159351.57 KB |
86480.41 KB |
120272.13 KB |
86480.13 KB |
ImmutableSortedDictionary |
1000000 |
False |
93757.37 KB |
117189.05 KB |
179626.93 KB |
117193.05 KB |
179629.06 KB |
117195.7 KB |
242110.66 KB |
117188.41 KB |
242110.66 KB |
117188.7 KB |
ImmutableList (Sorted) |
1000000 |
False |
97657.35 KB |
101563.09 KB |
121094.77 KB |
101563.36 KB |
121094.77 KB |
101563.36 KB |
148437.73 KB |
101563.01 KB |
148437.68 KB |
101562.73 KB |
Method | Length | Sorted | Int32 | String | StructInts | ClassInts | RecordStructInts | RecordClassInts | StructStrings | ClassStrings | RecordStructStrings | RecordClassStrings |
Array |
1000000 |
True |
3906.32 KB |
7812.54 KB |
11718.88 KB |
7812.58 KB |
11718.89 KB |
7812.58 KB |
23437.6 KB |
7812.54 KB |
23437.6 KB |
7812.54 KB |
ImmutableArray |
1000000 |
True |
3906.32 KB |
7812.54 KB |
11718.88 KB |
7812.58 KB |
11718.89 KB |
7812.58 KB |
23437.6 KB |
7812.54 KB |
23437.6 KB |
7812.54 KB |
ReadOnlyCollection |
1000000 |
True |
3906.34 KB |
7813.17 KB |
11718.91 KB |
7813.23 KB |
11718.91 KB |
7813.23 KB |
23437.62 KB |
7812.57 KB |
23437.62 KB |
7812.57 KB |
List |
1000000 |
True |
3906.35 KB |
7813.17 KB |
11718.92 KB |
7813.24 KB |
11718.92 KB |
7813.24 KB |
23437.63 KB |
7812.57 KB |
23437.63 KB |
7812.57 KB |
ImmutableArray (Sorted) |
1000000 |
True |
3906.4 KB |
7812.62 KB |
11718.9 KB |
7812.59 KB |
11718.9 KB |
7812.58 KB |
23437.62 KB |
7812.62 KB |
23437.62 KB |
7812.65 KB |
Array (Sorted) |
1000000 |
True |
3906.4 KB |
7812.91 KB |
11718.9 KB |
7812.66 KB |
11718.9 KB |
7812.66 KB |
23437.91 KB |
7812.91 KB |
23437.91 KB |
7812.91 KB |
List (Sorted) |
1000000 |
True |
3906.43 KB |
7812.66 KB |
11718.93 KB |
7812.69 KB |
11718.93 KB |
7812.67 KB |
23437.95 KB |
7812.95 KB |
23437.95 KB |
7812.95 KB |
HashSet |
1000000 |
True |
18169.71 KB |
22711.04 KB |
58516.56 KB |
22711.04 KB |
27251.66 KB |
22711.04 KB |
79955.34 KB |
22709 KB |
40875.99 KB |
22709 KB |
Dictionary |
1000000 |
True |
22709.02 KB |
31792.56 KB |
63058.48 KB |
31792.49 KB |
31792.5 KB |
31792.55 KB |
89039.55 KB |
31792.48 KB |
49959.53 KB |
31792.48 KB |
ReadOnlyDictionary |
1000000 |
True |
22709.06 KB |
31792.6 KB |
63059.83 KB |
31792.59 KB |
31792.54 KB |
31792.59 KB |
89040.11 KB |
31792.52 KB |
49959.57 KB |
31792.52 KB |
SortedList |
1000000 |
True |
27591.97 KB |
40590.23 KB |
75753.15 KB |
40585.89 KB |
44487.96 KB |
40585.89 KB |
113455.11 KB |
40581.96 KB |
74373.95 KB |
40581.96 KB |
SortedSet |
1000000 |
True |
42969.5 KB |
54687.96 KB |
58594.55 KB |
54690.08 KB |
58594.55 KB |
54690.08 KB |
85937.68 KB |
54687.96 KB |
85937.96 KB |
54687.96 KB |
FrozenSet |
1000000 |
True |
44677.28 KB |
105720.5 KB |
157881.09 KB |
83011.55 KB |
95365.64 KB |
83011.55 KB |
210569.13 KB |
83011.61 KB |
132428.59 KB |
83011.61 KB |
ImmutableList |
1000000 |
True |
46875.67 KB |
46875.35 KB |
54688.21 KB |
46875.36 KB |
54688.21 KB |
46875.41 KB |
62500.24 KB |
46875.14 KB |
62500.24 KB |
46875.1 KB |
LinkedList |
1000000 |
True |
46875.8 KB |
46875.43 KB |
54688.34 KB |
46875.48 KB |
54688.35 KB |
46875.5 KB |
62500.32 KB |
46875.22 KB |
62500.31 KB |
46875.22 KB |
ImmutableSortedSet |
1000000 |
True |
50781.94 KB |
54687.72 KB |
66407.01 KB |
54687.97 KB |
66407 KB |
54688.15 KB |
85937.72 KB |
54688 KB |
85938 KB |
54688 KB |
ImmutableDictionary |
1000000 |
True |
54688.41 KB |
62507.51 KB |
93779.72 KB |
62507.74 KB |
62507.17 KB |
62511.77 KB |
117220.78 KB |
62508.29 KB |
78133.12 KB |
62507.52 KB |
ImmutableHashSet |
1000000 |
True |
54689.05 KB |
54692.52 KB |
93801.93 KB |
54700.17 KB |
62514.63 KB |
54695.41 KB |
109421.66 KB |
54693.31 KB |
70318.62 KB |
54693.17 KB |
FrozenDictionary |
1000000 |
True |
58008.48 KB |
116757.2 KB |
167306.32 KB |
100884.43 KB |
104790.37 KB |
100884.43 KB |
228444.45 KB |
100884.17 KB |
150301.16 KB |
100884.17 KB |
SortedDictionary |
1000000 |
True |
69585.11 KB |
86480.08 KB |
117746.1 KB |
86485.45 KB |
86480.75 KB |
86480.81 KB |
159352.07 KB |
86480.13 KB |
120272.13 KB |
86480.41 KB |
ImmutableSortedDictionary |
1000000 |
True |
93751.88 KB |
117188.78 KB |
179627.3 KB |
117195.74 KB |
179627.27 KB |
117188.76 KB |
242110.38 KB |
117188.41 KB |
242110.66 KB |
117188.41 KB |
ImmutableList (Sorted) |
1000000 |
True |
97657.34 KB |
101563.08 KB |
121094.81 KB |
101563.06 KB |
121094.82 KB |
101563.34 KB |
148438.01 KB |
101563.01 KB |
148438.01 KB |
101563.01 KB |