Skip to content

Instantly share code, notes, and snippets.

@jokokko
Created January 17, 2019 08:48
Show Gist options
  • Save jokokko/53af6d5f5b11e783c6a150d529e87ebf to your computer and use it in GitHub Desktop.
Save jokokko/53af6d5f5b11e783c6a150d529e87ebf to your computer and use it in GitHub Desktop.
IdentityMap - ConcurrentDictionary vs. ImHashMap
BenchmarkDotNet=v0.11.3, OS=Windows 10.0.17134.523 (1803/April2018Update/Redstone4)
Intel Core i7-6700 CPU 3.40GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
Frequency=3328124 Hz, Resolution=300.4696 ns, Timer=TSC
.NET Core SDK=2.2.101
  [Host]     : .NET Core 2.1.7 (CoreCLR 4.6.27129.04, CoreFX 4.6.27129.04), 64bit RyuJIT
  DefaultJob : .NET Core 2.1.7 (CoreCLR 4.6.27129.04, CoreFX 4.6.27129.04), 64bit RyuJIT

Method ItemCount Mean Error StdDev Median Ratio RatioSD Gen 0/1k Op Gen 1/1k Op Gen 2/1k Op Allocated Memory/Op
PopulateIdentityMapWithConcurrentDictionary 10 13.17 us 0.3817 us 1.1255 us 12.66 us 1.00 0.00 3.1738 - - 13.05 KB
PopulateIdentityMapWithImHashMap 10 11.06 us 0.2317 us 0.6062 us 10.97 us 0.84 0.07 2.7161 - - 11.17 KB
PopulateIdentityMapWithConcurrentDictionary 100 122.45 us 2.3957 us 2.6628 us 122.61 us 1.00 0.00 31.7383 - - 130.47 KB
PopulateIdentityMapWithImHashMap 100 109.69 us 2.1723 us 2.1335 us 109.50 us 0.90 0.03 27.2217 - - 111.72 KB
PopulateIdentityMapWithConcurrentDictionary 1000 1,480.76 us 39.9880 us 117.9056 us 1,461.06 us 1.00 0.00 318.3594 - - 1304.69 KB
PopulateIdentityMapWithImHashMap 1000 1,254.93 us 24.5501 us 47.2998 us 1,243.10 us 0.84 0.09 271.4844 - - 1117.19 KB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment