-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
dotnet/corefx
#40106Labels
area-System.Collectionshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Milestone
Description
Just wondering why and is it OK that Hashset.Contains working twice slower than Dictionary<>.ContainsKey?
BenchmarkDotNet=v0.11.4, OS=Windows 10.0.17763.379 (1809/October2018Update/Redstone5)
Intel Core i7-8700 CPU 3.20GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores
.NET Core SDK=2.2.202
[Host] : .NET Core 2.1.9 (CoreCLR 4.6.27414.06, CoreFX 4.6.27415.01), 64bit RyuJIT
Job-LTAIYF : .NET Core 2.2.3 (CoreCLR 4.6.27414.05, CoreFX 4.6.27414.05), 64bit RyuJIT
Runtime=Core Toolchain=netcoreapp2.2
| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
|---|---|---|---|---|---|---|---|---|---|
| DictionaryRead | 14.4459 ns | 0.0218 ns | 0.0193 ns | 1.00 | 0.00 | - | - | - | - |
| DictionaryContainsKey | 12.8847 ns | 0.0206 ns | 0.0193 ns | 0.89 | 0.00 | - | - | - | - |
| HashSetContains | 24.1862 ns | 0.3764 ns | 0.3336 ns | 1.67 | 0.02 | - | - | - | - |
| DictionarySlimRead | 9.7710 ns | 0.0786 ns | 0.0735 ns | 0.68 | 0.01 | - | - | - | - |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-System.Collectionshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors