|
| 1 | +<details><summary>Stack</summary> |
| 2 | + |
| 3 | +### Primitive types: |
| 4 | +Stack elements are primitives: `byte`, `float`, `int`, `short`, `decimal`... . |
| 5 | + |
| 6 | +| Method | Size | Mean | Ratio | Allocated | |
| 7 | +|--------------------------- |-------- |---------------:|------:|----------:| |
| 8 | +| **StackMemoryCollections** | **100** | **369.2 ns** | **1.05** | **400 B** | |
| 9 | +| System.Collections.Generic | 100 | 350.0 ns | 1.00 | 456 B | |
| 10 | +| | | | | | |
| 11 | +| **StackMemoryCollections** | **1000** | **2,777.0 ns** | **0.81** | **4000 B** | |
| 12 | +| System.Collections.Generic | 1000 | 3,408.0 ns | 1.00 | 4056 B | |
| 13 | +| | | | | | |
| 14 | +| **StackMemoryCollections** | **10000** | **26,643.4 ns** | **0.77** | **40000 B** | |
| 15 | +| System.Collections.Generic | 10000 | 34,708.5 ns | 1.00 | 40056 B | |
| 16 | +| | | | | | |
| 17 | +| **StackMemoryCollections** | **100000** | **279,317.0 ns** | **0.60** | **400000 B** | |
| 18 | +| System.Collections.Generic | 100000 | 467,766.8 ns | 1.00 | 400098 B | |
| 19 | +| | | | | | |
| 20 | +| **StackMemoryCollections** | **250000** | **705,213.9 ns** | **0.60** | **1000001 B** | |
| 21 | +| System.Collections.Generic | 250000 | 1,171,231.2 ns | 1.00 | 1000140 B | |
| 22 | +| | | | | | |
| 23 | +| **StackMemoryCollections** | **500000** | **1,670,376.9 ns** | **0.71** | **2000002 B** | |
| 24 | +| System.Collections.Generic | 500000 | 2,341,880.7 ns | 1.00 | 2000225 B | |
| 25 | +| | | | | | |
| 26 | +| **StackMemoryCollections** | **1000000** | **3,326,526.8 ns** | **0.71** | **4000006 B** | |
| 27 | +| System.Collections.Generic | 1000000 | 4,683,416.4 ns | 1.00 | 4000393 B | |
| 28 | + |
| 29 | +[Code](https://github.com/SoftStoneDevelop/StackMemoryCollections/blob/main/Src/Benchmarks/Stack/Simple/PrimitiveSimpleJob.cs) |
| 30 | +______ |
| 31 | + |
| 32 | +| Method | Size | Mean | Ratio | Allocated | |
| 33 | +|--------------------------- |-------- |--------------:|------:|------------:| |
| 34 | +| **StackMemoryCollections** | **100** | **56.60 μs** | **1.04** | **400 B** | |
| 35 | +| System.Collections.Generic | 100 | 54.59 μs | 1.00 | 91200 B | |
| 36 | +| | | | | | |
| 37 | +| **StackMemoryCollections** | **1000** | **488.73 μs** | **0.94** | **4001 B** | |
| 38 | +| System.Collections.Generic | 1000 | 519.02 μs | 1.00 | 811200 B | |
| 39 | +| | | | | | |
| 40 | +| **StackMemoryCollections** | **10000** | **4,809.66 μs** | **0.90** | **40007 B** | |
| 41 | +| System.Collections.Generic | 10000 | 5,368.13 μs | 1.00 | 8011204 B | |
| 42 | +| | | | | | |
| 43 | +| **StackMemoryCollections** | **100000** | **48,078.07 μs** | **0.64** | **400136 B** | |
| 44 | +| System.Collections.Generic | 100000 | 74,574.55 μs | 1.00 | 80019867 B | |
| 45 | +| | | | | | |
| 46 | +| **StackMemoryCollections** | **250000** | **120,246.62 μs** | **0.65** | **1000872 B** | |
| 47 | +| System.Collections.Generic | 250000 | 186,345.43 μs | 1.00 | 200029085 B | |
| 48 | +| | | | | | |
| 49 | +| **StackMemoryCollections** | **500000** | **240,641.79 μs** | **0.66** | **2000235 B** | |
| 50 | +| System.Collections.Generic | 500000 | 367,274.71 μs | 1.00 | 400048032 B | |
| 51 | +| | | | | | |
| 52 | +| **StackMemoryCollections** | **1000000** | **481,340.25 μs** | **0.64** | **4003792 B** | |
| 53 | +| System.Collections.Generic | 1000000 | 750,769.20 μs | 1.00 | 800080288 B | |
| 54 | + |
| 55 | +[Code](https://github.com/SoftStoneDevelop/StackMemoryCollections/blob/main/Src/Benchmarks/Stack/Optimal/PrimitiveOptimalJob.cs) |
| 56 | +______ |
| 57 | +### Class: |
| 58 | +Stack elements are classes. |
| 59 | +| Method | Size | Mean | Ratio | Allocated | |
| 60 | +|--------------------------- |-------- |-----------------:|------:|-----------:| |
| 61 | +| **StackMemoryCollections** | **100** | **757.4 ns** | **0.55** | **2424 B** | |
| 62 | +| System.Collections.Generic | 100 | 1,378.3 ns | 1.00 | 8056 B | |
| 63 | +| | | | | | |
| 64 | +| **StackMemoryCollections** | **1000** | **7,004.2 ns** | **0.51** | **24024 B** | |
| 65 | +| System.Collections.Generic | 1000 | 13,713.2 ns | 1.00 | 80056 B | |
| 66 | +| | | | | | |
| 67 | +| **StackMemoryCollections** | **10000** | **84,682.6 ns** | **0.58** | **240024 B** | |
| 68 | +| System.Collections.Generic | 10000 | 146,452.7 ns | 1.00 | 800056 B | |
| 69 | +| | | | | | |
| 70 | +| **StackMemoryCollections** | **100000** | **1,436,862.3 ns** | **0.34** | **2400025 B** | |
| 71 | +| System.Collections.Generic | 100000 | 4,409,689.9 ns | 1.00 | 8000222 B | |
| 72 | +| | | | | | |
| 73 | +| **StackMemoryCollections** | **250000** | **3,647,072.0 ns** | **0.18** | **6000028 B** | |
| 74 | +| System.Collections.Generic | 250000 | 20,485,464.3 ns | 1.00 | 20000287 B | |
| 75 | +| | | | | | |
| 76 | +| **StackMemoryCollections** | **500000** | **6,939,238.0 ns** | **0.14** | **12000028 B** | |
| 77 | +| System.Collections.Generic | 500000 | 50,628,540.0 ns | 1.00 | 40000420 B | |
| 78 | +| | | | | | |
| 79 | +| **StackMemoryCollections** | **1000000** | **13,830,743.4 ns** | **0.11** | **24000032 B** | |
| 80 | +| System.Collections.Generic | 1000000 | 129,356,360.0 ns | 1.00 | 80000790 B | |
| 81 | + |
| 82 | +[Code](https://github.com/SoftStoneDevelop/StackMemoryCollections/blob/main/Src/Benchmarks/Stack/Simple/ClassSimpleJob.cs) |
| 83 | +______ |
| 84 | + |
| 85 | +| Method | Size | Mean | Ratio | Allocated | |
| 86 | +|--------------------------- |-------- |----------------:|------:|--------------:| |
| 87 | +| **StackMemoryCollections** | **100** | **137.7 μs** | **0.56** | **2424 B** | |
| 88 | +| System.Collections.Generic | 100 | 246.0 μs | 1.00 | 1611200 B | |
| 89 | +| | | | | | |
| 90 | +| **StackMemoryCollections** | **1000** | **1,338.0 μs** | **0.57** | **24025 B** | |
| 91 | +| System.Collections.Generic | 1000 | 2,356.5 μs | 1.00 | 16011202 B | |
| 92 | +| | | | | | |
| 93 | +| **StackMemoryCollections** | **10000** | **14,030.9 μs** | **0.55** | **240032 B** | |
| 94 | +| System.Collections.Generic | 10000 | 25,265.6 μs | 1.00 | 160011220 B | |
| 95 | +| | | | | | |
| 96 | +| **StackMemoryCollections** | **100000** | **135,796.6 μs** | **0.18** | **2400358 B** | |
| 97 | +| System.Collections.Generic | 100000 | 708,012.4 μs | 1.00 | 1600044272 B | |
| 98 | +| | | | | | |
| 99 | +| **StackMemoryCollections** | **250000** | **336,080.1 μs** | **0.09** | **6001112 B** | |
| 100 | +| System.Collections.Generic | 250000 | 3,987,479.2 μs | 1.00 | 4000059496 B | |
| 101 | +| | | | | | |
| 102 | +| **StackMemoryCollections** | **500000** | **688,559.2 μs** | **0.06** | **12000504 B** | |
| 103 | +| System.Collections.Generic | 500000 | 11,788,582.6 μs | 1.00 | 8000116584 B | |
| 104 | +| | | | | | |
| 105 | +| **StackMemoryCollections** | **1000000** | **2,288,730.2 μs** | **0.07** | **24000504 B** | |
| 106 | +| System.Collections.Generic | 1000000 | 32,844,409.8 μs | 1.00 | 16000122016 B | |
| 107 | + |
| 108 | +[Code](https://github.com/SoftStoneDevelop/StackMemoryCollections/blob/main/Src/Benchmarks/Stack/Optimal/ClassOptimalJob.cs) |
| 109 | +______ |
| 110 | +### Struct: |
| 111 | +Stack elements are structures. |
| 112 | + |
| 113 | +| Method | Size | Mean | Ratio | Allocated | |
| 114 | +|--------------------------- |-------- |----------------:|------:|-----------:| |
| 115 | +| **StackMemoryCollections** | **100** | **387.6 ns** | **0.33** | **2400 B** | |
| 116 | +| System.Collections.Generic | 100 | 1,183.7 ns | 1.00 | 3256 B | |
| 117 | +| | | | | | |
| 118 | +| **StackMemoryCollections** | **1000** | **3,246.9 ns** | **0.28** | **24000 B** | |
| 119 | +| System.Collections.Generic | 1000 | 11,496.5 ns | 1.00 | 32056 B | |
| 120 | +| | | | | | |
| 121 | +| **StackMemoryCollections** | **10000** | **41,866.3 ns** | **0.21** | **240000 B** | |
| 122 | +| System.Collections.Generic | 10000 | 197,441.8 ns | 1.00 | 320090 B | |
| 123 | +| | | | | | |
| 124 | +| **StackMemoryCollections** | **100000** | **895,636.1 ns** | **0.51** | **2400000 B** | |
| 125 | +| System.Collections.Generic | 100000 | 1,973,598.3 ns | 1.00 | 3200392 B | |
| 126 | +| | | | | | |
| 127 | +| **StackMemoryCollections** | **250000** | **1,719,951.9 ns** | **0.42** | **6000001 B** | |
| 128 | +| System.Collections.Generic | 250000 | 4,104,451.0 ns | 1.00 | 8000150 B | |
| 129 | +| | | | | | |
| 130 | +| **StackMemoryCollections** | **500000** | **4,265,441.4 ns** | **0.55** | **12000002 B** | |
| 131 | +| System.Collections.Generic | 500000 | 7,727,996.1 ns | 1.00 | 16000156 B | |
| 132 | +| | | | | | |
| 133 | +| **StackMemoryCollections** | **1000000** | **8,731,516.6 ns** | **0.45** | **24000004 B** | |
| 134 | +| System.Collections.Generic | 1000000 | 20,522,355.3 ns | 1.00 | 32000396 B | |
| 135 | + |
| 136 | +[Code](https://github.com/SoftStoneDevelop/StackMemoryCollections/blob/main/Src/Benchmarks/Stack/Simple/StructSimpleJob.cs) |
| 137 | +______ |
| 138 | + |
| 139 | +| Method | Size | Mean | Ratio | Allocated | |
| 140 | +|--------------------------- |-------- |----------------:|------:|-------------:| |
| 141 | +| **StackOfJobStruct** | **100** | **54.05 μs** | **0.25** | **2400 B** | |
| 142 | +| System.Collections.Generic | 100 | 219.89 μs | 1.00 | 651200 B | |
| 143 | +| | | | | | |
| 144 | +| **StackOfJobStruct** | **1000** | **520.60 μs** | **0.24** | **24000 B** | |
| 145 | +| System.Collections.Generic | 1000 | 2,139.08 μs | 1.00 | 6411202 B | |
| 146 | +| | | | | | |
| 147 | +| **StackOfJobStruct** | **10000** | **5,341.41 μs** | **0.15** | **240004 B** | |
| 148 | +| System.Collections.Generic | 10000 | 36,358.46 μs | 1.00 | 64017930 B | |
| 149 | +| | | | | | |
| 150 | +| **StackOfJobStruct** | **100000** | **53,834.98 μs** | **0.15** | **2400107 B** | |
| 151 | +| System.Collections.Generic | 100000 | 357,425.35 μs | 1.00 | 640081632 B | |
| 152 | +| | | | | | |
| 153 | +| **StackOfJobStruct** | **250000** | **134,170.07 μs** | **0.17** | **6000888 B** | |
| 154 | +| System.Collections.Generic | 250000 | 768,718.03 μs | 1.00 | 1600028840 B | |
| 155 | +| | | | | | |
| 156 | +| **StackOfJobStruct** | **500000** | **271,483.13 μs** | **0.19** | **12000240 B** | |
| 157 | +| System.Collections.Generic | 500000 | 1,432,699.91 μs | 1.00 | 3200030400 B | |
| 158 | +| | | | | | |
| 159 | +| **StackOfJobStruct** | **1000000** | **549,009.97 μs** | **0.14** | **24003568 B** | |
| 160 | +| System.Collections.Generic | 1000000 | 3,855,068.21 μs | 1.00 | 6400079184 B | |
| 161 | + |
| 162 | +[Code](https://github.com/SoftStoneDevelop/StackMemoryCollections/blob/main/Src/Benchmarks/Stack/Optimal/StructOptimalJob.cs) |
| 163 | + |
| 164 | +______ |
| 165 | + |
| 166 | +</details> |
0 commit comments