Rasagar/Library/PackageCache/com.unity.collections/Documentation~/performance-comparison-containers.md
2024-08-26 23:07:20 +03:00

148 KiB
Raw Permalink Blame History

Performance Comparison: Containers

This file is auto-generated

All measurments were taken on Intel(R) Core(TM) i9-9900KS CPU @ 4.00GHz with 16 logical cores.
Unity Editor version: 2022.3.6f1
To regenerate this file locally use: DOTS -> Unity.Collections -> Generate *** menu.

Table of Contents

Benchmark Results

The Median of 10 sample sets is compared against the baseline on the far right side of the table.
Multithreaded benchmarks divide the processing amongst the specified number of workers.
5 extra sample sets are run as warmup.

Legend

(S) = Safety Enabled
(B) = Burst Compiled with Safety Disabled
(S+B) = Burst Compiled with Safety Enabled
(BCL) = Base Class Library implementation (such as provided by Mono or .NET)

italic results are for benchmarking comparison only; these are not included in standard Performance Framework tests


HashMap

Functionality NativeHashMap (S) NativeHashMap (S+B) NativeHashMap (B) UnsafeHashMap (S) UnsafeHashMap (S+B) UnsafeHashMap (B) Dictionary (BCL)
IsEmpty_x_100k(0)¹ 0.342ms (0.4x) 🟠 0.111ms (1.1x)       0.133ms (0.9x)       0.221ms (0.5x)       0.105ms (1.1x) 🟢 0.106ms (1.1x)       0.120ms (1.0x)      
IsEmpty_x_100k(100)¹ 0.342ms (0.4x) 🟠 0.112ms (1.1x)       0.133ms (0.9x)       0.221ms (0.5x)       0.106ms (1.1x)       0.106ms (1.1x) 🟢 0.120ms (1.0x)      
Count_x_100k(0)¹ 0.261ms (0.5x) 🟠 0.142ms (0.8x)       0.108ms (1.1x) 🟢 0.120ms (1.0x)       0.111ms (1.1x)       0.111ms (1.1x)       0.120ms (1.0x)      
Count_x_100k(100)¹ 0.261ms (0.5x) 🟠 0.142ms (0.8x)       0.111ms (1.1x) 🟢 0.120ms (1.0x)       0.111ms (1.1x)       0.111ms (1.1x)       0.120ms (1.0x)      
ToNativeArrayKeys(10000) 0.151ms (0.1x)       0.126ms (0.1x)       0.092ms (0.2x)       0.159ms (0.1x) 🟠 0.125ms (0.1x)       0.083ms (0.2x)       0.018ms (1.0x) 🟢
ToNativeArrayKeys(100000) 1.659ms (0.1x) 🟠 1.214ms (0.1x)       0.918ms (0.2x)       1.610ms (0.1x)       1.205ms (0.1x)       0.908ms (0.2x)       0.174ms (1.0x) 🟢
ToNativeArrayKeys(1000000) 21.689ms (0.1x) 🟠 13.624ms (0.2x)       10.721ms (0.2x)       19.842ms (0.1x)       13.505ms (0.2x)       10.569ms (0.2x)       2.059ms (1.0x) 🟢
ToNativeArrayValues(10000) 0.160ms (0.1x)       0.118ms (0.2x)       0.086ms (0.2x)       0.161ms (0.1x) 🟠 0.125ms (0.1x)       0.084ms (0.2x)       0.018ms (1.0x) 🟢
ToNativeArrayValues(100000) 1.702ms (0.1x)       1.192ms (0.1x)       0.935ms (0.2x)       1.721ms (0.1x) 🟠 1.196ms (0.1x)       0.919ms (0.2x)       0.173ms (1.0x) 🟢
ToNativeArrayValues(1000000) 20.402ms (0.1x)       13.609ms (0.1x)       11.017ms (0.2x)       20.556ms (0.1x) 🟠 13.773ms (0.1x)       10.869ms (0.2x)       2.018ms (1.0x) 🟢
Insert(10000) 0.135ms (1.3x)       0.070ms (2.5x)       0.061ms (2.9x)       0.120ms (1.5x)       0.060ms (2.9x) 🟢 0.061ms (2.9x)       0.175ms (1.0x) 🟠
Insert(100000) 1.723ms (1.3x)       0.996ms (2.2x)       0.914ms (2.4x)       1.565ms (1.4x)       0.909ms (2.4x)       0.889ms (2.5x) 🟢 2.209ms (1.0x) 🟠
Insert(1000000) 33.017ms (0.9x)       21.056ms (1.4x)       19.847ms (1.5x)       50.228ms (0.6x) 🟠 19.654ms (1.5x)       19.613ms (1.5x) 🟢 29.738ms (1.0x)      
AddGrow(4, 1048576)³ 137.459ms (0.4x) 🟠 81.364ms (0.6x)       77.039ms (0.6x)       133.603ms (0.4x)       78.458ms (0.6x)       76.533ms (0.6x)       49.222ms (1.0x) 🟢
AddGrow(65536, 1048576)³ 140.883ms (0.4x) 🟠 82.611ms (0.6x)       77.670ms (0.6x)       134.717ms (0.4x)       79.913ms (0.6x)       77.316ms (0.6x)       50.215ms (1.0x) 🟢
Contains(10000) 0.089ms (2.1x)       0.036ms (5.1x)       0.027ms (6.8x)       0.101ms (1.9x)       0.029ms (6.4x)       0.025ms (7.4x) 🟢 0.188ms (1.0x) 🟠
Contains(100000) 1.696ms (1.7x)       0.694ms (4.1x)       0.508ms (5.6x)       1.945ms (1.5x)       0.538ms (5.3x)       0.482ms (5.9x) 🟢 2.843ms (1.0x) 🟠
Contains(1000000) 42.805ms (1.5x)       17.135ms (3.6x)       12.633ms (4.9x)       43.284ms (1.4x)       12.700ms (4.9x)       11.703ms (5.3x) 🟢 62.072ms (1.0x) 🟠
IndexedRead(10000) 0.109ms (1.7x)       0.028ms (6.7x)       0.032ms (5.9x)       0.122ms (1.6x)       0.027ms (7.1x)       0.026ms (7.1x) 🟢 0.189ms (1.0x) 🟠
IndexedRead(100000) 1.983ms (1.4x)       0.592ms (4.7x)       0.614ms (4.5x)       2.125ms (1.3x)       0.543ms (5.1x) 🟢 0.545ms (5.1x)       2.791ms (1.0x) 🟠
IndexedRead(1000000) 57.739ms (1.1x)       16.881ms (3.7x)       16.937ms (3.7x)       57.860ms (1.1x)       14.918ms (4.1x) 🟢 15.113ms (4.1x)       61.850ms (1.0x) 🟠
IndexedWrite(10000) 0.103ms (2.0x)       0.080ms (2.6x)       0.040ms (5.2x)       0.084ms (2.5x)       0.039ms (5.3x)       0.036ms (5.8x) 🟢 0.209ms (1.0x) 🟠
IndexedWrite(100000) 1.890ms (1.6x)       1.269ms (2.4x)       0.755ms (4.1x)       1.473ms (2.1x)       0.759ms (4.1x)       0.707ms (4.3x) 🟢 3.074ms (1.0x) 🟠
IndexedWrite(1000000) 73.370ms (1.0x)       69.054ms (1.1x)       65.695ms (1.1x) 🟢 73.500ms (1.0x)       65.870ms (1.1x)       66.574ms (1.1x)       73.729ms (1.0x) 🟠
TryGetValue(10000) 0.105ms (1.8x)       0.033ms (5.7x)       0.032ms (5.9x)       0.120ms (1.6x)       0.029ms (6.6x) 🟢 0.029ms (6.6x) 🟢 0.191ms (1.0x) 🟠
TryGetValue(100000) 1.943ms (1.4x)       0.645ms (4.4x)       0.637ms (4.4x)       2.102ms (1.3x)       0.574ms (4.9x)       0.557ms (5.1x) 🟢 2.816ms (1.0x) 🟠
TryGetValue(1000000) 55.056ms (1.1x)       18.084ms (3.4x)       17.878ms (3.5x)       59.138ms (1.0x)       15.889ms (3.9x)       15.692ms (4.0x) 🟢 62.067ms (1.0x) 🟠
Remove(10000) 0.110ms (1.4x)       0.044ms (3.6x)       0.035ms (4.5x)       0.094ms (1.7x)       0.029ms (5.4x)       0.028ms (5.6x) 🟢 0.158ms (1.0x) 🟠
Remove(100000) 1.889ms (1.3x)       0.844ms (2.8x)       0.661ms (3.6x)       3.654ms (0.7x) 🟠 0.566ms (4.2x)       0.547ms (4.4x) 🟢 2.395ms (1.0x)      
Remove(1000000) 62.623ms (1.0x)       56.372ms (1.1x)       53.877ms (1.2x) 🟢 61.104ms (1.0x)       54.841ms (1.1x)       55.805ms (1.1x)       62.915ms (1.0x) 🟠
Foreach(10000) 0.150ms (0.3x) 🟠 0.083ms (0.5x)       0.077ms (0.5x)       0.141ms (0.3x)       0.077ms (0.5x)       0.079ms (0.5x)       0.041ms (1.0x) 🟢
Foreach(100000) 1.984ms (0.2x) 🟠 0.924ms (0.4x)       0.866ms (0.5x)       1.869ms (0.2x)       0.865ms (0.5x)       0.885ms (0.5x)       0.412ms (1.0x) 🟢
Foreach(1000000) 27.605ms (0.2x) 🟠 10.947ms (0.4x)       10.421ms (0.4x)       26.351ms (0.2x)       10.457ms (0.4x)       10.619ms (0.4x)       4.359ms (1.0x) 🟢

¹ Optimizations were disabled to perform this benchmark
³ AddGrow(capacity, growTo) -- Incrementally grows from capacity until reaching size of growTo



HashSet

Functionality NativeHashSet (S) NativeHashSet (S+B) NativeHashSet (B) UnsafeHashSet (S) UnsafeHashSet (S+B) UnsafeHashSet (B) HashSet (BCL)
IsEmpty_x_100k(0)¹ 0.342ms (0.4x) 🟠 0.112ms (1.3x)       0.133ms (1.1x)       0.221ms (0.6x)       0.106ms (1.3x) 🟢 0.106ms (1.3x)       0.140ms (1.0x)      
IsEmpty_x_100k(100)¹ 0.342ms (0.4x) 🟠 0.112ms (1.3x)       0.133ms (1.1x)       0.221ms (0.6x)       0.106ms (1.3x)       0.106ms (1.3x) 🟢 0.140ms (1.0x)      
Count_x_100k(0)¹ 0.261ms (0.5x) 🟠 0.143ms (1.0x)       0.111ms (1.3x)       0.100ms (1.4x) 🟢 0.111ms (1.3x)       0.108ms (1.3x)       0.140ms (1.0x)      
Count_x_100k(100)¹ 0.261ms (0.5x) 🟠 0.142ms (1.0x)       0.111ms (1.3x)       0.100ms (1.4x) 🟢 0.111ms (1.3x)       0.111ms (1.3x)       0.140ms (1.0x)      
ToNativeArray(10000) 0.043ms (0.4x) 🟠 0.015ms (1.2x)       0.009ms (1.9x)       0.043ms (0.4x)       0.015ms (1.2x)       0.009ms (1.9x) 🟢 0.018ms (1.0x)      
ToNativeArray(100000) 0.475ms (0.4x)       0.144ms (1.2x)       0.085ms (2.1x) 🟢 0.485ms (0.4x) 🟠 0.144ms (1.2x)       0.085ms (2.1x) 🟢 0.176ms (1.0x)      
ToNativeArray(1000000) 4.935ms (0.4x)       1.591ms (1.2x)       0.989ms (1.9x) 🟢 5.378ms (0.4x) 🟠 1.586ms (1.2x)       0.997ms (1.9x)       1.927ms (1.0x)      
Insert(10000) 0.093ms (1.1x)       0.044ms (2.3x)       0.040ms (2.6x)       0.078ms (1.3x)       0.039ms (2.6x)       0.035ms (2.9x) 🟢 0.103ms (1.0x) 🟠
Insert(100000) 0.937ms (1.1x)       0.441ms (2.3x)       0.403ms (2.6x)       0.785ms (1.3x)       0.390ms (2.6x)       0.351ms (2.9x) 🟢 1.029ms (1.0x) 🟠
Insert(1000000) 12.275ms (0.8x) 🟠 7.030ms (1.5x)       6.650ms (1.6x) 🟢 10.495ms (1.0x)       6.902ms (1.5x)       6.747ms (1.5x)       10.384ms (1.0x)      
AddGrow(4, 1048576)³ 76.515ms (0.3x) 🟠 35.430ms (0.6x)       33.171ms (0.6x)       75.704ms (0.3x)       32.776ms (0.6x)       30.928ms (0.7x)       20.387ms (1.0x) 🟢
AddGrow(65536, 1048576)³ 75.192ms (0.3x) 🟠 34.149ms (0.6x)       32.652ms (0.6x)       74.248ms (0.3x)       34.092ms (0.6x)       32.440ms (0.6x)       19.978ms (1.0x) 🟢
Contains(10000) 0.061ms (1.8x)       0.017ms (6.7x)       0.010ms (11.5x)       0.072ms (1.6x)       0.013ms (8.9x)       0.009ms (12.5x) 🟢 0.113ms (1.0x) 🟠
Contains(100000) 0.949ms (1.7x)       0.311ms (5.2x)       0.199ms (8.1x)       1.104ms (1.5x)       0.207ms (7.8x)       0.180ms (8.9x) 🟢 1.610ms (1.0x) 🟠
Contains(1000000) 11.436ms (1.7x)       3.877ms (4.9x)       2.576ms (7.4x)       13.252ms (1.4x)       2.653ms (7.2x)       2.373ms (8.0x) 🟢 19.089ms (1.0x) 🟠
Remove(10000) 0.111ms (1.7x)       0.054ms (3.4x)       0.044ms (4.3x)       0.101ms (1.8x)       0.036ms (5.2x) 🟢 0.040ms (4.6x)       0.186ms (1.0x) 🟠
Remove(100000) 1.327ms (1.6x)       0.645ms (3.2x)       0.531ms (3.9x)       1.218ms (1.7x)       0.438ms (4.7x) 🟢 0.477ms (4.4x)       2.076ms (1.0x) 🟠
Remove(1000000) 15.132ms (1.5x)       7.264ms (3.2x)       5.953ms (3.9x)       26.197ms (0.9x) 🟠 4.917ms (4.7x) 🟢 5.268ms (4.4x)       23.150ms (1.0x)      
Foreach(10000) 0.081ms (0.4x) 🟠 0.029ms (1.2x)       0.016ms (2.3x) 🟢 0.054ms (0.7x)       0.017ms (2.2x)       0.017ms (2.2x)       0.036ms (1.0x)      
Foreach(100000) 0.766ms (0.5x) 🟠 0.241ms (1.5x)       0.135ms (2.6x) 🟢 0.505ms (0.7x)       0.145ms (2.5x)       0.145ms (2.5x)       0.356ms (1.0x)      
Foreach(1000000) 7.540ms (0.5x) 🟠 2.280ms (1.6x)       1.431ms (2.5x) 🟢 4.906ms (0.7x)       1.524ms (2.4x)       1.516ms (2.4x)       3.638ms (1.0x)      
UnionWith(10000) 0.226ms (1.1x)       0.144ms (1.8x)       0.128ms (2.0x)       0.191ms (1.3x)       0.119ms (2.1x)       0.116ms (2.2x) 🟢 0.254ms (1.0x) 🟠
UnionWith(100000) 2.545ms (1.4x)       1.664ms (2.1x)       1.486ms (2.3x)       2.140ms (1.6x)       1.370ms (2.5x)       1.349ms (2.6x) 🟢 3.441ms (1.0x) 🟠
UnionWith(1000000) 80.802ms (0.7x) 🟠 43.823ms (1.4x)       39.187ms (1.5x) 🟢 74.811ms (0.8x)       45.527ms (1.3x)       40.115ms (1.5x)       59.785ms (1.0x)      
IntersectWith(10000) 0.246ms (1.1x)       0.142ms (1.9x)       0.123ms (2.2x)       0.201ms (1.3x)       0.107ms (2.5x)       0.105ms (2.6x) 🟢 0.270ms (1.0x) 🟠
IntersectWith(100000) 2.705ms (1.3x)       1.546ms (2.2x)       1.405ms (2.4x)       2.218ms (1.5x)       1.189ms (2.9x) 🟢 1.231ms (2.8x)       3.436ms (1.0x) 🟠
IntersectWith(1000000) 33.228ms (2.0x)       19.026ms (3.4x)       17.066ms (3.8x)       27.030ms (2.4x)       14.937ms (4.4x) 🟢 15.096ms (4.3x)       65.055ms (1.0x) 🟠
ExceptWith(10000) 0.212ms (1.0x)       0.125ms (1.7x)       0.107ms (2.0x)       0.175ms (1.3x)       0.094ms (2.3x)       0.093ms (2.4x) 🟢 0.218ms (1.0x) 🟠
ExceptWith(100000) 2.374ms (1.2x)       1.419ms (2.0x)       1.257ms (2.2x)       1.992ms (1.4x)       1.109ms (2.5x) 🟢 1.110ms (2.5x)       2.799ms (1.0x) 🟠
ExceptWith(1000000) 35.627ms (1.1x)       19.482ms (2.0x)       17.001ms (2.3x)       29.688ms (1.3x)       15.493ms (2.6x) 🟢 15.620ms (2.5x)       39.627ms (1.0x) 🟠

¹ Optimizations were disabled to perform this benchmark
³ AddGrow(capacity, growTo) -- Incrementally grows from capacity until reaching size of growTo



List

Functionality NativeList (S) NativeList (S+B) NativeList (B) UnsafeList (S) UnsafeList (S+B) UnsafeList (B) List (BCL)
IsEmpty_x_100k(0)¹ 0.154ms (0.9x)       0.121ms (1.2x)       0.111ms (1.3x)       0.161ms (0.9x) 🟠 0.106ms (1.3x) 🟢 0.106ms (1.3x) 🟢 0.140ms (1.0x)      
IsEmpty_x_100k(100)¹ 0.154ms (0.9x)       0.121ms (1.2x)       0.111ms (1.3x)       0.161ms (0.9x) 🟠 0.106ms (1.3x)       0.106ms (1.3x) 🟢 0.140ms (1.0x)      
Count_x_100k(0)¹ 0.120ms (1.0x) 🟠 0.111ms (1.1x)       0.111ms (1.1x)       0.020ms (6.0x) 🟢 0.081ms (1.5x)       0.108ms (1.1x)       0.120ms (1.0x)      
Count_x_100k(100)¹ 0.120ms (1.0x) 🟠 0.111ms (1.1x)       0.111ms (1.1x)       0.020ms (6.0x) 🟢 0.081ms (1.5x)       0.108ms (1.1x)       0.120ms (1.0x) 🟠
ToNativeArray(10000) 0.002ms (1.4x)       0.002ms (1.8x)       0.002ms (1.9x) 🟢 --- --- --- 0.003ms (1.0x) 🟠
ToNativeArray(100000) 0.088ms (0.3x) 🟠 0.015ms (1.9x)       0.015ms (2.0x) 🟢 --- --- --- 0.029ms (1.0x)      
ToNativeArray(1000000) 0.906ms (0.3x) 🟠 0.143ms (2.1x) 🟢 0.148ms (2.1x)       --- --- --- 0.306ms (1.0x)      
Add(10000) 0.040ms (0.4x) 🟠 0.014ms (1.0x)       0.016ms (0.9x)       0.017ms (0.9x)       0.007ms (2.2x) 🟢 0.007ms (2.2x)       0.014ms (1.0x)      
Add(100000) 0.400ms (0.4x) 🟠 0.140ms (1.0x)       0.155ms (0.9x)       0.166ms (0.9x)       0.061ms (2.3x) 🟢 0.061ms (2.3x) 🟢 0.144ms (1.0x)      
Add(1000000) 4.000ms (0.4x) 🟠 1.399ms (1.0x)       1.548ms (0.9x)       1.654ms (0.9x)       0.605ms (2.4x) 🟢 0.608ms (2.4x)       1.436ms (1.0x)      
AddGrow(4, 1048576)³ 4.647ms (0.5x) 🟠 1.886ms (1.3x)       1.759ms (1.4x)       2.141ms (1.1x)       1.026ms (2.3x) 🟢 1.033ms (2.3x)       2.402ms (1.0x)      
AddGrow(65536, 1048576)³ 4.604ms (0.5x) 🟠 1.865ms (1.3x)       1.773ms (1.3x)       2.122ms (1.1x)       1.083ms (2.2x)       1.010ms (2.4x) 🟢 2.381ms (1.0x)      
Contains(1000) 0.371ms (1.1x)       0.086ms (4.6x)       0.084ms (4.7x)       0.370ms (1.1x)       0.148ms (2.7x)       0.084ms (4.7x) 🟢 0.394ms (1.0x) 🟠
Contains(10000) 37.241ms (1.2x)       7.565ms (6.0x)       7.548ms (6.0x)       37.203ms (1.2x)       7.541ms (6.0x) 🟢 7.544ms (6.0x)       45.509ms (1.0x) 🟠
IndexedRead(10000) 0.037ms (0.6x) 🟠 0.009ms (2.7x)       0.005ms (4.8x)       0.022ms (1.0x)       0.005ms (5.0x) 🟢 0.005ms (4.9x)       0.023ms (1.0x)      
IndexedRead(100000) 0.474ms (0.7x) 🟠 0.090ms (3.6x)       0.068ms (4.8x)       0.268ms (1.2x)       0.077ms (4.2x)       0.068ms (4.8x) 🟢 0.328ms (1.0x)      
IndexedRead(1000000) 5.416ms (0.7x) 🟠 1.487ms (2.6x)       1.341ms (2.9x) 🟢 3.197ms (1.2x)       1.395ms (2.8x)       1.357ms (2.9x)       3.897ms (1.0x)      
IndexedWrite(10000) 0.028ms (1.0x)       0.011ms (2.6x)       0.007ms (4.4x)       0.018ms (1.6x)       0.006ms (4.6x) 🟢 0.010ms (3.0x)       0.029ms (1.0x) 🟠
IndexedWrite(100000) 0.311ms (1.1x)       0.125ms (2.7x) 🟢 0.135ms (2.5x)       0.220ms (1.5x)       0.136ms (2.4x)       0.132ms (2.5x)       0.331ms (1.0x) 🟠
IndexedWrite(1000000) 3.656ms (1.1x)       1.892ms (2.1x)       1.868ms (2.1x)       2.775ms (1.4x)       1.796ms (2.2x)       1.744ms (2.3x) 🟢 3.956ms (1.0x) 🟠
Remove(1000) 0.087ms (0.3x) 🟠 0.011ms (1.9x)       0.011ms (2.1x)       0.085ms (0.3x)       0.011ms (2.0x)       0.010ms (2.2x) 🟢 0.022ms (1.0x)      
Remove(10000) 7.626ms (0.1x) 🟠 0.732ms (1.2x)       0.717ms (1.2x)       7.616ms (0.1x)       0.716ms (1.2x)       0.704ms (1.2x) 🟢 0.853ms (1.0x)      
Foreach(10000) 0.038ms (0.6x) 🟠 0.004ms (5.8x)       0.003ms (8.8x)       0.016ms (1.5x)       0.003ms (9.0x) 🟢 0.003ms (9.0x) 🟢 0.024ms (1.0x)      
Foreach(100000) 0.381ms (0.6x) 🟠 0.037ms (6.5x)       0.024ms (10.0x)       0.160ms (1.5x)       0.024ms (10.0x) 🟢 0.024ms (10.0x) 🟢 0.242ms (1.0x)      
Foreach(1000000) 3.815ms (0.6x) 🟠 0.360ms (6.7x)       0.229ms (10.6x)       1.621ms (1.5x)       0.226ms (10.7x) 🟢 0.226ms (10.7x)       2.419ms (1.0x)      

¹ Optimizations were disabled to perform this benchmark
³ AddGrow(capacity, growTo) -- Incrementally grows from capacity until reaching size of growTo



ParallelHashMap

Functionality NativeParallelHashMap (S) NativeParallelHashMap (S+B) NativeParallelHashMap (B) UnsafeParallelHashMap (S) UnsafeParallelHashMap (S+B) UnsafeParallelHashMap (B) ConcurrentDictionary (BCL)
IsEmpty_x_100k(1, 0)¹ 0.462ms (176.1x)       0.141ms (577.9x)       0.109ms (748.4x) 🟢 0.261ms (312.0x)       0.162ms (501.5x)       0.174ms (469.0x)       81.423ms (1.0x) 🟠
IsEmpty_x_100k(2, 0)¹˒² 0.234ms (551.2x)       0.072ms (1782.5x) 🟢 0.090ms (1427.8x)       0.134ms (965.2x)       0.096ms (1338.9x)       0.091ms (1412.9x)       129.140ms (1.0x) 🟠
IsEmpty_x_100k(4, 0)¹˒² 0.267ms (644.7x)       0.042ms (4088.3x) 🟢 0.050ms (3473.0x)       0.078ms (2214.0x)       0.048ms (3604.1x)       0.047ms (3626.9x)       171.914ms (1.0x) 🟠
IsEmpty_x_100k(1, 100)¹ 0.682ms (114.0x)       0.238ms (326.4x)       0.242ms (322.0x)       0.582ms (133.7x)       0.181ms (429.8x)       0.181ms (429.9x) 🟢 77.786ms (1.0x) 🟠
IsEmpty_x_100k(2, 100)¹˒² 0.380ms (341.5x)       0.124ms (1046.8x)       0.142ms (911.2x)       0.295ms (440.2x)       0.093ms (1399.5x) 🟢 0.095ms (1370.0x)       129.804ms (1.0x) 🟠
IsEmpty_x_100k(4, 100)¹˒² 0.354ms (490.4x)       0.114ms (1518.7x)       0.125ms (1385.9x)       0.217ms (799.6x)       0.109ms (1596.9x)       0.062ms (2818.0x) 🟢 173.587ms (1.0x) 🟠
Count_x_100k(1, 0)¹ 0.535ms (150.8x)       0.201ms (401.0x)       0.155ms (521.9x) 🟢 0.287ms (280.9x)       0.181ms (445.7x)       0.161ms (501.3x)       80.634ms (1.0x) 🟠
Count_x_100k(2, 0)¹˒² 0.271ms (455.4x)       0.103ms (1195.2x)       0.080ms (1532.7x) 🟢 0.148ms (831.5x)       0.093ms (1326.5x)       0.083ms (1491.0x)       123.229ms (1.0x) 🟠
Count_x_100k(4, 0)¹˒² 0.144ms (1320.5x)       0.061ms (3106.4x)       0.046ms (4132.8x) 🟢 0.083ms (2294.1x)       0.103ms (1846.0x)       0.051ms (3730.1x)       189.491ms (1.0x) 🟠
Count_x_100k(1, 100)¹ 3.685ms (25.7x)       1.444ms (65.7x) 🟢 1.693ms (56.0x)       3.191ms (29.7x)       1.544ms (61.4x)       1.614ms (58.8x)       94.884ms (1.0x) 🟠
Count_x_100k(2, 100)¹˒² 1.845ms (73.9x)       0.736ms (185.3x) 🟢 0.887ms (153.8x)       1.595ms (85.5x)       0.773ms (176.6x)       0.825ms (165.4x)       136.423ms (1.0x) 🟠
Count_x_100k(4, 100)¹˒² 1.613ms (113.9x)       0.708ms (259.3x)       0.707ms (259.9x)       1.460ms (125.8x)       0.746ms (246.2x)       0.689ms (266.5x) 🟢 183.655ms (1.0x) 🟠
ToNativeArrayKeys(1, 10000) 0.150ms (1.2x)       0.121ms (1.5x)       0.081ms (2.2x) 🟢 0.201ms (0.9x) 🟠 0.129ms (1.4x)       0.111ms (1.6x)       0.180ms (1.0x)      
ToNativeArrayKeys(1, 100000) 1.652ms (1.4x)       1.243ms (1.9x)       1.052ms (2.2x) 🟢 1.796ms (1.3x)       1.402ms (1.7x)       1.053ms (2.2x)       2.336ms (1.0x) 🟠
ToNativeArrayKeys(1, 1000000) 36.653ms (0.7x) 🟠 17.665ms (1.4x)       12.848ms (2.0x)       36.236ms (0.7x)       18.985ms (1.3x)       10.798ms (2.3x) 🟢 25.361ms (1.0x)      
ToNativeArrayValues(1, 10000) 0.150ms (0.9x)       0.121ms (1.2x)       0.080ms (1.8x)       0.151ms (0.9x) 🟠 0.122ms (1.2x)       0.079ms (1.8x) 🟢 0.141ms (1.0x)      
ToNativeArrayValues(1, 100000) 1.626ms (1.1x)       1.235ms (1.4x)       0.862ms (2.1x) 🟢 1.629ms (1.1x)       1.229ms (1.4x)       0.872ms (2.0x)       1.773ms (1.0x) 🟠
ToNativeArrayValues(1, 1000000) 20.867ms (1.1x)       15.371ms (1.5x)       11.046ms (2.1x)       24.782ms (1.0x) 🟠 17.345ms (1.4x)       10.785ms (2.2x) 🟢 23.593ms (1.0x)      
Insert(1, 10000) 0.353ms (5.6x)       0.209ms (9.5x)       0.212ms (9.3x)       0.320ms (6.2x)       0.205ms (9.6x) 🟢 0.211ms (9.4x)       1.979ms (1.0x) 🟠
Insert(2, 10000)² 0.543ms (4.3x)       0.514ms (4.5x)       0.329ms (7.1x)       0.400ms (5.8x)       0.266ms (8.8x) 🟢 0.379ms (6.1x)       2.330ms (1.0x) 🟠
Insert(4, 10000)² 0.449ms (5.2x)       0.290ms (8.0x)       0.217ms (10.6x) 🟢 0.285ms (8.1x)       0.249ms (9.3x)       0.270ms (8.6x)       2.314ms (1.0x) 🟠
Insert(1, 100000) 3.818ms (5.8x)       2.325ms (9.5x)       2.281ms (9.6x)       3.442ms (6.4x)       2.218ms (9.9x) 🟢 2.285ms (9.6x)       21.983ms (1.0x) 🟠
Insert(2, 100000)² 5.611ms (4.1x)       4.873ms (4.8x)       3.254ms (7.1x)       4.090ms (5.7x)       2.645ms (8.8x) 🟢 3.080ms (7.5x)       23.181ms (1.0x) 🟠
Insert(4, 100000)² 4.523ms (5.3x)       2.897ms (8.3x)       2.156ms (11.2x)       3.541ms (6.8x)       2.201ms (11.0x)       2.096ms (11.5x) 🟢 24.121ms (1.0x) 🟠
Insert(1, 1000000) 60.383ms (7.0x)       36.007ms (11.8x) 🟢 36.109ms (11.8x)       53.923ms (7.9x)       36.016ms (11.8x)       36.542ms (11.6x)       425.024ms (1.0x) 🟠
Insert(2, 1000000)² 62.895ms (7.1x)       50.118ms (8.9x)       40.151ms (11.1x)       50.271ms (8.8x)       39.964ms (11.1x)       38.384ms (11.6x) 🟢 443.920ms (1.0x) 🟠
Insert(4, 1000000)² 42.694ms (7.6x)       36.240ms (9.0x)       24.896ms (13.1x)       30.771ms (10.6x)       24.408ms (13.3x) 🟢 25.097ms (13.0x)       325.595ms (1.0x) 🟠
AddGrow(1, 4, 1048576)³ 72.547ms (5.9x)       39.816ms (10.7x)       39.313ms (10.8x)       71.458ms (6.0x)       39.813ms (10.7x)       39.265ms (10.8x) 🟢 425.495ms (1.0x) 🟠
AddGrow(1, 65536, 1048576)³ 68.046ms (10.0x)       39.004ms (17.5x)       38.764ms (17.6x)       67.198ms (10.2x)       38.417ms (17.8x) 🟢 38.540ms (17.7x)       683.780ms (1.0x) 🟠
Contains(1, 10000) 0.145ms (1.6x)       0.033ms (6.9x)       0.028ms (8.0x) 🟢 0.118ms (1.9x)       0.036ms (6.3x)       0.029ms (7.9x)       0.228ms (1.0x) 🟠
Contains(2, 10000)² 0.127ms (1.5x)       0.042ms (4.6x)       0.036ms (5.4x) 🟢 0.111ms (1.8x)       0.038ms (5.2x)       0.036ms (5.3x)       0.194ms (1.0x) 🟠
Contains(4, 10000)² 0.167ms (1.3x)       0.052ms (4.1x)       0.055ms (3.9x)       0.100ms (2.1x)       0.068ms (3.1x)       0.039ms (5.5x) 🟢 0.213ms (1.0x) 🟠
Contains(1, 100000) 2.247ms (1.5x)       0.650ms (5.0x)       0.498ms (6.6x) 🟢 1.849ms (1.8x)       0.650ms (5.0x)       0.500ms (6.6x)       3.277ms (1.0x) 🟠
Contains(2, 100000)² 1.226ms (1.4x)       0.403ms (4.4x)       0.328ms (5.4x) 🟢 1.077ms (1.6x)       0.408ms (4.3x)       0.330ms (5.3x)       1.761ms (1.0x) 🟠
Contains(4, 100000)² 1.065ms (2.2x)       0.334ms (7.0x)       0.268ms (8.7x) 🟢 0.883ms (2.6x)       0.319ms (7.3x)       0.540ms (4.3x)       2.332ms (1.0x) 🟠
Contains(1, 1000000) 66.122ms (1.5x)       16.585ms (5.9x)       12.089ms (8.0x) 🟢 59.523ms (1.6x)       17.021ms (5.7x)       12.118ms (8.0x)       97.095ms (1.0x) 🟠
Contains(2, 1000000)² 31.624ms (1.6x)       8.707ms (5.8x)       6.498ms (7.8x) 🟢 29.568ms (1.7x)       8.714ms (5.8x)       6.511ms (7.8x)       50.806ms (1.0x) 🟠
Contains(4, 1000000)² 25.406ms (1.7x)       6.925ms (6.3x)       5.677ms (7.7x)       22.636ms (1.9x)       6.716ms (6.5x)       5.494ms (7.9x) 🟢 43.614ms (1.0x) 🟠
IndexedRead(1, 10000) 0.145ms (1.6x)       0.029ms (8.1x) 🟢 0.032ms (7.3x)       0.137ms (1.7x)       0.031ms (7.5x)       0.031ms (7.7x)       0.235ms (1.0x) 🟠
IndexedRead(2, 10000)² 0.202ms (1.4x)       0.059ms (4.9x)       0.062ms (4.7x)       0.191ms (1.5x)       0.041ms (7.0x) 🟢 0.066ms (4.4x)       0.288ms (1.0x) 🟠
IndexedRead(4, 10000)² 0.581ms (0.9x) 🟠 0.129ms (3.9x)       0.098ms (5.1x)       0.264ms (1.9x)       0.071ms (7.1x) 🟢 0.097ms (5.2x)       0.501ms (1.0x)      
IndexedRead(1, 100000) 2.216ms (1.5x)       0.592ms (5.6x) 🟢 0.604ms (5.5x)       2.140ms (1.5x)       0.600ms (5.5x)       0.607ms (5.4x)       3.291ms (1.0x) 🟠
IndexedRead(2, 100000)² 2.416ms (1.5x)       0.698ms (5.0x)       0.692ms (5.1x) 🟢 2.270ms (1.5x)       0.707ms (5.0x)       0.743ms (4.7x)       3.506ms (1.0x) 🟠
IndexedRead(4, 100000)² 4.094ms (1.4x)       1.071ms (5.4x)       1.053ms (5.5x) 🟢 7.214ms (0.8x) 🟠 1.058ms (5.5x)       1.794ms (3.2x)       5.780ms (1.0x)      
IndexedRead(1, 1000000) 64.603ms (1.5x)       17.636ms (5.5x)       17.726ms (5.5x)       62.234ms (1.6x)       17.652ms (5.5x)       17.411ms (5.6x) 🟢 96.983ms (1.0x) 🟠
IndexedRead(2, 1000000)² 63.460ms (1.6x)       17.217ms (5.8x)       17.124ms (5.8x)       61.578ms (1.6x)       17.127ms (5.8x)       16.957ms (5.8x) 🟢 99.146ms (1.0x) 🟠
IndexedRead(4, 1000000)² 68.243ms (1.4x)       28.318ms (3.4x)       27.812ms (3.5x)       69.192ms (1.4x)       26.990ms (3.6x) 🟢 27.918ms (3.5x)       97.383ms (1.0x) 🟠
IndexedWrite(1, 10000) 0.164ms (2.8x)       0.051ms (9.0x)       0.041ms (11.0x)       0.131ms (3.5x)       0.040ms (11.4x)       0.038ms (12.0x) 🟢 0.456ms (1.0x) 🟠
IndexedWrite(1, 100000) 2.333ms (2.6x)       0.901ms (6.7x)       0.731ms (8.3x)       2.077ms (2.9x)       0.781ms (7.8x)       0.710ms (8.5x) 🟢 6.067ms (1.0x) 🟠
IndexedWrite(1, 1000000) 76.627ms (2.5x)       67.296ms (2.8x) 🟢 68.052ms (2.8x)       85.977ms (2.2x)       68.516ms (2.8x)       69.221ms (2.8x)       191.108ms (1.0x) 🟠
TryGetValue(1, 10000) 0.154ms (1.3x)       0.043ms (4.8x)       0.032ms (6.4x)       0.117ms (1.8x)       0.043ms (4.8x)       0.031ms (6.6x) 🟢 0.206ms (1.0x) 🟠
TryGetValue(2, 10000)² 0.125ms (1.4x)       0.045ms (3.8x)       0.036ms (4.8x) 🟢 0.110ms (1.6x)       0.046ms (3.7x)       0.036ms (4.8x)       0.172ms (1.0x) 🟠
TryGetValue(4, 10000)² 0.170ms (0.7x) 🟠 0.051ms (2.4x)       0.038ms (3.3x) 🟢 0.103ms (1.2x)       0.078ms (1.6x)       0.039ms (3.2x)       0.125ms (1.0x)      
TryGetValue(1, 100000) 2.187ms (1.5x)       0.839ms (4.0x)       0.616ms (5.4x) 🟢 1.925ms (1.7x)       0.815ms (4.1x)       0.628ms (5.3x)       3.336ms (1.0x) 🟠
TryGetValue(2, 100000)² 1.216ms (1.5x)       0.478ms (3.7x)       0.342ms (5.2x) 🟢 1.072ms (1.7x)       0.489ms (3.6x)       0.391ms (4.5x)       1.769ms (1.0x) 🟠
TryGetValue(4, 100000)² 1.042ms (1.7x)       0.408ms (4.3x) 🟢 0.617ms (2.8x)       0.899ms (1.9x)       0.915ms (1.9x)       0.636ms (2.7x)       1.736ms (1.0x) 🟠
TryGetValue(1, 1000000) 65.145ms (1.5x)       25.321ms (3.8x)       19.163ms (5.0x)       59.895ms (1.6x)       23.602ms (4.1x)       18.464ms (5.2x) 🟢 96.395ms (1.0x) 🟠
TryGetValue(2, 1000000)² 31.724ms (1.5x)       12.422ms (4.0x)       9.631ms (5.1x)       30.638ms (1.6x)       12.432ms (4.0x)       9.589ms (5.1x) 🟢 49.107ms (1.0x) 🟠
TryGetValue(4, 1000000)² 25.831ms (1.6x)       10.070ms (4.1x)       7.992ms (5.2x) 🟢 23.710ms (1.8x)       10.235ms (4.1x)       8.062ms (5.2x)       41.691ms (1.0x) 🟠
Remove(1, 10000) 0.120ms (4.5x)       0.214ms (2.5x)       0.050ms (11.0x)       0.095ms (5.7x)       0.050ms (10.9x)       0.049ms (11.1x) 🟢 0.545ms (1.0x) 🟠
Remove(1, 100000) 1.928ms (3.4x)       0.929ms (7.0x)       0.805ms (8.1x)       1.682ms (3.9x)       0.867ms (7.5x)       0.793ms (8.2x) 🟢 6.512ms (1.0x) 🟠
Remove(1, 1000000) 64.353ms (3.1x)       56.893ms (3.5x) 🟢 57.422ms (3.4x)       62.480ms (3.1x)       57.884ms (3.4x)       57.271ms (3.4x)       196.582ms (1.0x) 🟠
Foreach(1, 10000) 0.156ms (2.5x)       0.086ms (4.6x)       0.073ms (5.4x) 🟢 0.143ms (2.7x)       0.080ms (4.9x)       0.080ms (4.9x)       0.393ms (1.0x) 🟠
Foreach(1, 100000) 2.094ms (2.3x)       0.931ms (5.2x)       0.839ms (5.8x) 🟢 1.862ms (2.6x)       0.885ms (5.5x)       0.884ms (5.5x)       4.876ms (1.0x) 🟠
Foreach(1, 1000000) 28.544ms (2.0x)       11.060ms (5.1x)       10.143ms (5.6x) 🟢 27.167ms (2.1x)       10.318ms (5.5x)       10.364ms (5.5x)       56.852ms (1.0x) 🟠

¹ Optimizations were disabled to perform this benchmark
² Benchmark run on parallel job workers - results may vary
³ AddGrow(workers, capacity, growTo) -- Incrementally grows from capacity until reaching size of growTo



ParallelHashSet

Functionality NativeParallelHashSet (S) NativeParallelHashSet (S+B) NativeParallelHashSet (B) UnsafeParallelHashSet (S) UnsafeParallelHashSet (S+B) UnsafeParallelHashSet (B) HashSet w/lock (BCL)
IsEmpty_x_100k(1, 0)¹ 0.482ms (9.2x)       0.115ms (38.5x) 🟢 0.176ms (25.1x)       0.301ms (14.7x)       0.183ms (24.2x)       0.171ms (25.8x)       4.422ms (1.0x) 🟠
IsEmpty_x_100k(2, 0)¹˒² 0.244ms (61.6x)       0.060ms (250.7x) 🟢 0.092ms (164.2x)       0.154ms (98.0x)       0.091ms (166.2x)       0.086ms (175.3x)       15.041ms (1.0x) 🟠
IsEmpty_x_100k(4, 0)¹˒² 0.274ms (114.9x)       0.037ms (849.5x) 🟢 0.048ms (659.1x)       0.153ms (206.3x)       0.049ms (640.4x)       0.047ms (667.5x)       31.474ms (1.0x) 🟠
IsEmpty_x_100k(1, 100)¹ 0.567ms (7.8x)       0.128ms (34.7x)       0.201ms (22.0x)       0.401ms (11.0x)       0.142ms (31.2x)       0.108ms (40.9x) 🟢 4.424ms (1.0x) 🟠
IsEmpty_x_100k(2, 100)¹˒² 0.288ms (52.5x)       0.068ms (221.0x)       0.105ms (143.5x)       0.217ms (69.9x)       0.074ms (205.5x)       0.057ms (264.5x) 🟢 15.128ms (1.0x) 🟠
IsEmpty_x_100k(4, 100)¹˒² 0.315ms (99.6x)       0.072ms (437.6x)       0.058ms (538.5x)       0.185ms (169.8x)       0.046ms (686.0x)       0.037ms (842.3x) 🟢 31.420ms (1.0x) 🟠
Count_x_100k(1, 0)¹ 0.535ms (8.3x)       0.201ms (22.1x)       0.161ms (27.6x)       0.456ms (9.7x)       0.181ms (24.5x)       0.161ms (27.6x) 🟢 4.435ms (1.0x) 🟠
Count_x_100k(2, 0)¹˒² 0.271ms (59.0x)       0.103ms (155.8x)       0.082ms (193.8x) 🟢 0.231ms (69.1x)       0.093ms (171.9x)       0.083ms (192.9x)       15.965ms (1.0x) 🟠
Count_x_100k(4, 0)¹˒² 0.224ms (173.7x)       0.115ms (337.8x)       0.049ms (789.8x) 🟢 0.164ms (237.0x)       0.054ms (724.3x)       0.073ms (529.1x)       38.861ms (1.0x) 🟠
Count_x_100k(1, 100)¹ 4.426ms (1.0x)       1.620ms (2.7x)       1.517ms (2.9x) 🟢 3.323ms (1.3x)       1.538ms (2.9x)       2.268ms (2.0x)       4.438ms (1.0x) 🟠
Count_x_100k(2, 100)¹˒² 2.462ms (6.2x)       1.020ms (14.9x)       0.763ms (19.9x) 🟢 1.683ms (9.0x)       0.783ms (19.4x)       0.824ms (18.4x)       15.206ms (1.0x) 🟠
Count_x_100k(4, 100)¹˒² 1.778ms (18.1x)       0.848ms (37.9x)       0.723ms (44.5x)       1.556ms (20.7x)       0.744ms (43.2x)       0.665ms (48.4x) 🟢 32.165ms (1.0x) 🟠
ToNativeArray(1, 10000) 0.039ms (0.5x) 🟠 0.021ms (0.8x)       0.009ms (1.9x)       0.038ms (0.5x)       0.021ms (0.8x)       0.009ms (1.9x) 🟢 0.018ms (1.0x)      
ToNativeArray(1, 100000) 0.428ms (0.4x)       0.202ms (0.9x)       0.084ms (2.1x) 🟢 0.437ms (0.4x) 🟠 0.202ms (0.9x)       0.084ms (2.1x) 🟢 0.175ms (1.0x)      
ToNativeArray(1, 1000000) 4.489ms (0.4x)       2.192ms (0.9x)       1.051ms (1.9x) 🟢 4.690ms (0.4x) 🟠 2.187ms (0.9x)       1.053ms (1.9x)       1.964ms (1.0x)      
Insert(1, 10000) 0.330ms (11.3x)       0.188ms (19.7x)       0.196ms (19.0x)       0.301ms (12.4x)       0.186ms (20.0x) 🟢 0.202ms (18.4x)       3.715ms (1.0x) 🟠
Insert(2, 10000)² 0.468ms (33.2x)       0.487ms (31.9x)       0.264ms (58.9x)       0.317ms (49.0x)       0.260ms (59.8x) 🟢 0.331ms (47.0x)       15.537ms (1.0x) 🟠
Insert(4, 10000)² 0.285ms (168.3x)       0.319ms (150.7x)       0.169ms (283.9x) 🟢 0.244ms (196.6x)       0.207ms (231.4x)       0.225ms (212.9x)       48.000ms (1.0x) 🟠
Insert(1, 100000) 3.300ms (1.8x)       1.880ms (3.1x)       1.957ms (3.0x)       3.014ms (1.9x)       1.857ms (3.2x) 🟢 2.079ms (2.8x)       5.872ms (1.0x) 🟠
Insert(2, 100000)² 4.849ms (3.2x)       4.541ms (3.4x)       2.555ms (6.1x) 🟢 3.014ms (5.1x)       3.288ms (4.7x)       3.275ms (4.7x)       15.510ms (1.0x) 🟠
Insert(4, 100000)² 2.759ms (16.9x)       2.462ms (19.0x)       1.494ms (31.3x) 🟢 2.236ms (20.9x)       2.221ms (21.0x)       1.804ms (25.9x)       46.684ms (1.0x) 🟠
Insert(1, 1000000) 33.989ms (1.8x)       19.882ms (3.1x)       20.803ms (3.0x)       31.233ms (2.0x)       19.637ms (3.1x) 🟢 20.789ms (3.0x)       61.451ms (1.0x) 🟠
Insert(2, 1000000)² 48.854ms (1.4x)       46.969ms (1.5x)       27.594ms (2.5x) 🟢 31.891ms (2.2x)       33.639ms (2.1x)       35.067ms (2.0x)       70.068ms (1.0x) 🟠
Insert(4, 1000000)² 32.946ms (2.8x)       28.736ms (3.2x)       18.753ms (4.9x) 🟢 21.186ms (4.3x)       24.702ms (3.7x)       21.382ms (4.3x)       91.349ms (1.0x) 🟠
AddGrow(1, 4, 1048576)³ 36.009ms (1.8x)       12.228ms (5.4x)       11.699ms (5.6x) 🟢 34.592ms (1.9x)       11.898ms (5.5x)       11.875ms (5.6x)       65.912ms (1.0x) 🟠
AddGrow(1, 65536, 1048576)³ 33.973ms (1.7x)       11.863ms (4.9x)       11.247ms (5.2x)       32.550ms (1.8x)       11.464ms (5.1x)       11.203ms (5.2x) 🟢 58.064ms (1.0x) 🟠
Contains(1, 10000) 0.109ms (5.6x)       0.019ms (32.3x)       0.013ms (47.2x)       0.095ms (6.4x)       0.017ms (35.8x)       0.010ms (60.2x) 🟢 0.611ms (1.0x) 🟠
Contains(2, 10000)² 0.101ms (141.6x)       0.019ms (749.5x) 🟢 0.021ms (683.2x)       0.060ms (239.8x)       0.019ms (747.6x)       0.021ms (683.2x)       14.279ms (1.0x) 🟠
Contains(4, 10000)² 0.098ms (128.3x)       0.031ms (402.6x)       0.023ms (559.2x)       0.057ms (219.8x)       0.021ms (607.8x) 🟢 0.022ms (561.7x)       12.582ms (1.0x) 🟠
Contains(1, 100000) 1.531ms (4.6x)       0.284ms (24.8x)       0.191ms (36.8x)       1.345ms (5.2x)       0.300ms (23.5x)       0.191ms (36.9x) 🟢 7.043ms (1.0x) 🟠
Contains(2, 100000)² 0.925ms (23.2x)       0.225ms (95.8x)       0.165ms (130.4x) 🟢 0.827ms (26.0x)       0.227ms (94.7x)       0.166ms (129.7x)       21.506ms (1.0x) 🟠
Contains(4, 100000)² 0.717ms (46.9x)       0.204ms (164.7x)       0.120ms (279.4x) 🟢 0.689ms (48.8x)       0.389ms (86.5x)       0.275ms (122.2x)       33.617ms (1.0x) 🟠
Contains(1, 1000000) 18.170ms (4.5x)       3.754ms (21.7x)       2.522ms (32.4x)       16.496ms (4.9x)       3.749ms (21.8x)       2.491ms (32.8x) 🟢 81.628ms (1.0x) 🟠
Contains(2, 1000000)² 11.131ms (7.8x)       2.652ms (32.7x)       2.045ms (42.5x) 🟢 9.589ms (9.1x)       2.733ms (31.8x)       2.076ms (41.8x)       86.828ms (1.0x) 🟠
Contains(4, 1000000)² 8.584ms (12.8x)       3.407ms (32.3x)       2.220ms (49.5x)       8.219ms (13.4x)       2.053ms (53.5x) 🟢 2.324ms (47.3x)       109.936ms (1.0x) 🟠
Remove(1, 10000) 0.139ms (4.4x)       0.065ms (9.3x)       0.059ms (10.3x) 🟢 0.110ms (5.6x)       0.061ms (10.0x)       0.060ms (10.2x)       0.611ms (1.0x) 🟠
Remove(1, 100000) 1.694ms (3.9x)       0.798ms (8.4x)       0.689ms (9.7x) 🟢 1.314ms (5.1x)       0.707ms (9.5x)       0.695ms (9.6x)       6.684ms (1.0x) 🟠
Remove(1, 1000000) 20.302ms (3.7x)       9.389ms (8.0x)       7.772ms (9.7x) 🟢 15.004ms (5.0x)       8.087ms (9.3x)       7.788ms (9.6x)       75.082ms (1.0x) 🟠
Foreach(1, 10000) 0.097ms (0.4x) 🟠 0.024ms (1.4x)       0.018ms (1.9x)       0.068ms (0.5x)       0.018ms (2.0x) 🟢 0.018ms (2.0x)       0.035ms (1.0x)      
Foreach(1, 100000) 0.929ms (0.4x) 🟠 0.208ms (1.7x)       0.145ms (2.4x)       0.605ms (0.6x)       0.144ms (2.4x) 🟢 0.144ms (2.4x)       0.344ms (1.0x)      
Foreach(1, 1000000) 9.214ms (0.4x) 🟠 2.094ms (1.7x)       1.470ms (2.5x)       5.994ms (0.6x)       1.462ms (2.5x) 🟢 1.491ms (2.4x)       3.611ms (1.0x)      
UnionWith(1, 10000) 0.539ms (0.4x) 🟠 0.227ms (1.1x)       0.216ms (1.1x)       0.490ms (0.5x)       0.214ms (1.1x) 🟢 0.214ms (1.1x)       0.242ms (1.0x)      
UnionWith(1, 100000) 5.532ms (0.5x) 🟠 2.397ms (1.1x)       2.465ms (1.1x)       4.955ms (0.5x)       2.263ms (1.2x)       2.242ms (1.2x) 🟢 2.687ms (1.0x)      
UnionWith(1, 1000000) 79.156ms (0.6x) 🟠 41.627ms (1.2x)       36.230ms (1.4x)       72.721ms (0.7x)       36.150ms (1.4x) 🟢 36.708ms (1.3x)       48.928ms (1.0x)      
IntersectWith(1, 10000) 0.318ms (0.9x) 🟠 0.135ms (2.1x)       0.118ms (2.4x)       0.264ms (1.1x)       0.110ms (2.6x) 🟢 0.112ms (2.5x)       0.286ms (1.0x)      
IntersectWith(1, 100000) 3.460ms (0.9x) 🟠 1.490ms (2.0x)       1.322ms (2.2x)       2.881ms (1.0x)       1.259ms (2.4x) 🟢 1.280ms (2.3x)       2.963ms (1.0x)      
IntersectWith(1, 1000000) 50.949ms (1.3x)       18.330ms (3.6x)       16.081ms (4.1x)       41.292ms (1.6x)       15.816ms (4.1x) 🟢 15.828ms (4.1x)       65.453ms (1.0x) 🟠
ExceptWith(1, 10000) 0.269ms (0.9x) 🟠 0.213ms (1.1x)       0.118ms (2.0x)       0.197ms (1.2x)       0.115ms (2.0x)       0.112ms (2.1x) 🟢 0.230ms (1.0x)      
ExceptWith(1, 100000) 2.960ms (0.8x) 🟠 1.408ms (1.8x)       1.335ms (1.8x)       2.181ms (1.1x)       1.320ms (1.9x)       1.280ms (1.9x) 🟢 2.467ms (1.0x)      
ExceptWith(1, 1000000) 40.054ms (1.0x)       20.188ms (2.0x)       18.223ms (2.2x)       30.004ms (1.4x)       18.972ms (2.2x)       17.592ms (2.3x) 🟢 40.898ms (1.0x) 🟠

¹ Optimizations were disabled to perform this benchmark
² Benchmark run on parallel job workers - results may vary
³ AddGrow(workers, capacity, growTo) -- Incrementally grows from capacity until reaching size of growTo



QueueParallelWriter

Functionality NativeQueueParallelWriter (S) NativeQueueParallelWriter (S+B) NativeQueueParallelWriter (B) UnsafeQueueParallelWriter (S) UnsafeQueueParallelWriter (S+B) UnsafeQueueParallelWriter (B) ConcurrentQueue (BCL)
EnqueueGrow(1, 10000)³ 0.063ms (1.8x)       0.037ms (3.1x)       0.027ms (4.2x) 🟢 --- --- --- 0.112ms (1.0x) 🟠
EnqueueGrow(2, 10000)²˒³ 0.036ms (3.8x)       0.032ms (4.3x)       0.022ms (6.3x) 🟢 --- --- --- 0.136ms (1.0x) 🟠
EnqueueGrow(4, 10000)²˒³ 0.041ms (5.0x)       0.023ms (9.1x) 🟢 0.028ms (7.4x)       --- --- --- 0.205ms (1.0x) 🟠
EnqueueGrow(1, 100000)³ 1.111ms (1.0x) 🟠 0.196ms (5.5x) 🟢 0.249ms (4.3x)       --- --- --- 1.069ms (1.0x)      
EnqueueGrow(2, 100000)²˒³ 0.353ms (43.1x)       0.129ms (118.3x) 🟢 0.141ms (107.9x)       --- --- --- 15.233ms (1.0x) 🟠
EnqueueGrow(4, 100000)²˒³ 0.359ms (128.0x)       0.119ms (384.9x)       0.101ms (455.1x) 🟢 --- --- --- 45.962ms (1.0x) 🟠
EnqueueGrow(1, 1000000)³ 6.964ms (1.5x)       1.971ms (5.3x) 🟢 2.470ms (4.2x)       --- --- --- 10.493ms (1.0x) 🟠
EnqueueGrow(2, 1000000)²˒³ 3.587ms (4.2x)       1.264ms (12.0x) 🟢 1.353ms (11.2x)       --- --- --- 15.213ms (1.0x) 🟠
EnqueueGrow(4, 1000000)²˒³ 3.119ms (14.9x)       1.036ms (44.8x)       0.915ms (50.7x) 🟢 --- --- --- 46.400ms (1.0x) 🟠
Enqueue(1, 10000) 0.063ms (1.8x)       0.014ms (8.0x) 🟢 0.019ms (5.9x)       --- --- --- 0.112ms (1.0x) 🟠
Enqueue(2, 10000)²˒⁴ 0.043ms (3.1x)       0.015ms (8.7x)       0.013ms (10.1x) 🟢 --- --- --- 0.132ms (1.0x) 🟠
Enqueue(4, 10000)²˒⁴ 0.036ms (5.7x)       0.017ms (11.8x)       0.016ms (13.0x) 🟢 --- --- --- 0.203ms (1.0x) 🟠
Enqueue(1, 100000) 0.628ms (1.7x)       0.244ms (4.4x)       0.187ms (5.7x) 🟢 --- --- --- 1.068ms (1.0x) 🟠
Enqueue(2, 100000)²˒⁴ 0.329ms (46.3x)       0.142ms (107.6x)       0.107ms (142.5x) 🟢 --- --- --- 15.253ms (1.0x) 🟠
Enqueue(4, 100000)²˒⁴ 0.305ms (154.5x)       0.077ms (611.1x)       0.061ms (767.5x) 🟢 --- --- --- 47.086ms (1.0x) 🟠
Enqueue(1, 1000000) 6.283ms (1.7x)       1.374ms (7.6x) 🟢 1.869ms (5.6x)       --- --- --- 10.486ms (1.0x) 🟠
Enqueue(2, 1000000)²˒⁴ 3.268ms (4.7x)       0.896ms (17.0x) 🟢 1.029ms (14.8x)       --- --- --- 15.201ms (1.0x) 🟠
Enqueue(4, 1000000)²˒⁴ 2.931ms (15.8x)       0.638ms (72.4x) 🟢 0.697ms (66.3x)       --- --- --- 46.225ms (1.0x) 🟠

² Benchmark run on parallel job workers - results may vary
³ EnqueueGrow(workers, insertions)
Enqueue(workers, insertions)



Queue

Functionality NativeQueue (S) NativeQueue (S+B) NativeQueue (B) UnsafeQueue (S) UnsafeQueue (S+B) UnsafeQueue (B) Queue (BCL)
IsEmpty_x_100k(0)¹ 0.482ms (0.2x) 🟠 0.181ms (0.6x)       0.161ms (0.6x)       0.232ms (0.4x)       0.000ms (334.3x) 🟢 0.000ms (334.3x) 🟢 0.100ms (1.0x)      
IsEmpty_x_100k(100)¹ 0.503ms (0.2x) 🟠 0.188ms (0.5x)       0.141ms (0.7x)       0.241ms (0.4x)       0.000ms (334.3x) 🟢 0.000ms (334.3x) 🟢 0.100ms (1.0x)      
Count_x_100k(0)¹ 0.313ms (0.4x) 🟠 0.193ms (0.6x)       0.161ms (0.7x)       0.189ms (0.6x)       0.000ms (401.2x) 🟢 0.000ms (401.2x) 🟢 0.120ms (1.0x)      
Count_x_100k(100)¹ 0.351ms (0.3x) 🟠 0.181ms (0.7x)       0.141ms (0.9x)       0.231ms (0.5x)       0.000ms (401.2x) 🟢 0.000ms (343.9x)       0.120ms (1.0x)      
ToNativeArray(10000) 0.003ms (1.2x)       0.002ms (1.7x)       0.002ms (1.7x)       0.002ms (1.8x) 🟢 0.002ms (1.8x)       0.002ms (1.8x) 🟢 0.003ms (1.0x) 🟠
ToNativeArray(100000) 0.096ms (0.3x) 🟠 0.016ms (1.9x)       0.015ms (1.9x)       0.089ms (0.3x)       0.015ms (1.9x) 🟢 0.015ms (1.9x)       0.029ms (1.0x)      
ToNativeArray(1000000) 0.991ms (0.8x) 🟠 0.197ms (4.1x)       0.163ms (5.0x)       0.897ms (0.9x)       0.156ms (5.2x) 🟢 0.161ms (5.0x)       0.814ms (1.0x)      
EnqueueGrow(10000)³ 0.060ms (23.4x)       0.025ms (57.2x)       0.024ms (59.1x) 🟢 0.045ms (31.3x)       0.025ms (56.4x)       0.026ms (55.1x)       1.414ms (1.0x) 🟠
EnqueueGrow(100000)³ 0.657ms (0.6x) 🟠 0.249ms (1.6x)       0.231ms (1.8x) 🟢 0.445ms (0.9x)       0.241ms (1.7x)       0.248ms (1.6x)       0.407ms (1.0x)      
EnqueueGrow(1000000)³ 6.580ms (0.6x) 🟠 2.452ms (1.6x)       2.340ms (1.7x) 🟢 4.509ms (0.9x)       2.473ms (1.6x)       2.509ms (1.6x)       3.931ms (1.0x)      
Enqueue(10000) 0.060ms (0.8x) 🟠 0.019ms (2.4x)       0.018ms (2.5x) 🟢 0.039ms (1.2x)       0.020ms (2.3x)       0.020ms (2.2x)       0.046ms (1.0x)      
Enqueue(100000) 0.599ms (0.7x) 🟠 0.193ms (2.1x)       0.180ms (2.3x) 🟢 0.392ms (1.0x)       0.198ms (2.1x)       0.196ms (2.1x)       0.407ms (1.0x)      
Enqueue(1000000) 5.989ms (0.7x) 🟠 2.048ms (1.9x)       1.801ms (2.2x) 🟢 3.933ms (1.0x)       2.010ms (2.0x)       2.011ms (2.0x)       3.933ms (1.0x)      
Dequeue(10000) 0.066ms (0.6x) 🟠 0.025ms (1.4x)       0.016ms (2.4x) 🟢 0.045ms (0.8x)       0.017ms (2.2x)       0.017ms (2.2x)       0.037ms (1.0x)      
Dequeue(100000) 0.664ms (0.6x) 🟠 0.248ms (1.5x)       0.151ms (2.4x) 🟢 0.455ms (0.8x)       0.158ms (2.3x)       0.159ms (2.3x)       0.369ms (1.0x)      
Dequeue(1000000) 6.640ms (0.6x) 🟠 2.479ms (1.5x)       1.503ms (2.5x) 🟢 4.551ms (0.8x)       1.578ms (2.3x)       1.589ms (2.3x)       3.690ms (1.0x)      
Peek(10000)¹ 0.030ms (0.6x) 🟠 0.023ms (0.8x)       0.014ms (1.3x)       0.012ms (1.5x)       0.000ms (45.4x) 🟢 0.000ms (45.4x) 🟢 0.018ms (1.0x)      
Peek(100000)¹ 0.302ms (0.6x) 🟠 0.222ms (0.8x)       0.134ms (1.4x)       0.121ms (1.5x)       0.001ms (278.8x) 🟢 0.001ms (258.9x)       0.181ms (1.0x)      
Peek(1000000)¹ 3.016ms (0.6x) 🟠 2.213ms (0.8x)       1.369ms (1.3x)       1.205ms (1.5x)       0.001ms (2127.8x)       0.001ms (2260.8x) 🟢 1.809ms (1.0x)      
Foreach(10000) 0.028ms (1.5x)       0.009ms (4.9x)       0.007ms (6.4x)       0.018ms (2.3x)       0.003ms (13.9x)       0.003ms (14.1x) 🟢 0.042ms (1.0x) 🟠
Foreach(100000) 0.283ms (1.5x)       0.082ms (5.2x)       0.062ms (6.9x)       0.182ms (2.3x)       0.027ms (15.5x) 🟢 0.027ms (15.5x) 🟢 0.425ms (1.0x) 🟠
Foreach(1000000) 2.833ms (1.5x)       0.812ms (5.2x)       0.612ms (6.9x)       1.819ms (2.3x)       0.267ms (15.9x)       0.267ms (15.9x) 🟢 4.250ms (1.0x) 🟠

¹ Optimizations were disabled to perform this benchmark
³ EnqueueGrow(insertions)
Enqueue(insertions)



RingQueue

Functionality NativeRingQueue (S) NativeRingQueue (S+B) NativeRingQueue (B) UnsafeRingQueue (S) UnsafeRingQueue (S+B) UnsafeRingQueue (B) Queue (BCL)
IsEmpty_x_100k(0)¹ 0.174ms (0.7x) 🟠 0.108ms (1.1x) 🟢 0.108ms (1.1x) 🟢 0.121ms (1.0x)       0.111ms (1.1x)       0.110ms (1.1x)       0.121ms (1.0x)      
IsEmpty_x_100k(100)¹ 0.161ms (0.8x) 🟠 0.108ms (1.1x)       0.108ms (1.1x) 🟢 0.120ms (1.0x)       0.111ms (1.1x)       0.110ms (1.1x)       0.120ms (1.0x)      
Count_x_100k(0)¹ 0.192ms (0.5x) 🟠 0.142ms (0.7x)       0.108ms (0.9x)       0.120ms (0.8x)       0.111ms (0.9x)       0.111ms (0.9x)       0.101ms (1.0x) 🟢
Count_x_100k(100)¹ 0.188ms (0.5x) 🟠 0.143ms (0.7x)       0.110ms (0.9x)       0.120ms (0.8x)       0.111ms (0.9x)       0.111ms (0.9x)       0.100ms (1.0x) 🟢
Enqueue(10000) 0.033ms (1.1x)       0.019ms (1.9x)       0.018ms (2.0x)       0.019ms (1.9x)       0.017ms (2.0x) 🟢 0.018ms (2.0x)       0.035ms (1.0x) 🟠
Enqueue(100000) 0.331ms (1.1x)       0.183ms (1.9x)       0.173ms (2.0x)       0.182ms (1.9x)       0.172ms (2.0x) 🟢 0.173ms (2.0x)       0.349ms (1.0x) 🟠
Enqueue(1000000) 3.311ms (1.1x)       1.815ms (1.9x)       1.725ms (2.0x)       1.823ms (1.9x)       1.722ms (2.0x) 🟢 1.732ms (2.0x)       3.477ms (1.0x) 🟠
Dequeue(10000) 0.032ms (1.1x)       0.017ms (2.1x)       0.008ms (4.6x) 🟢 0.017ms (2.1x)       0.017ms (2.1x)       0.011ms (3.3x)       0.035ms (1.0x) 🟠
Dequeue(100000) 0.326ms (1.1x)       0.163ms (2.2x)       0.072ms (4.9x) 🟢 0.167ms (2.1x)       0.162ms (2.2x)       0.102ms (3.5x)       0.352ms (1.0x) 🟠
Dequeue(1000000) 3.257ms (1.1x)       1.624ms (2.2x)       0.708ms (5.0x) 🟢 1.666ms (2.1x)       1.612ms (2.2x)       1.008ms (3.5x)       3.516ms (1.0x) 🟠

¹ Optimizations were disabled to perform this benchmark