Which turns out fastest from variants I tried. (In benchmark it is List.containsTryFind).
I can extend benchmarks with more cases if needed.
I can make PR for this.
BenchmarkDotNet=v0.13.4, OS=Windows 10 (10.0.19045.3208)
12th Gen Intel Core i7-12800H, 1 CPU, 20 logical and 14 physical cores
.NET SDK=8.0.100-preview.6.23330.14
[Host] : .NET 7.0.9 (7.0.923.32018), X64 RyuJIT AVX2 DEBUG
DefaultJob : .NET 7.0.9 (7.0.923.32018), X64 RyuJIT AVX2
Hi,
we've found that
List.contains x xsis slower thanList.exists (fun y -> x = y) xs, details in my blog post: https://jindraivanek.hashnode.dev/curious-case-of-listcontains-performanceSummary:
List.containsis ~2x - ~14x slower based on type in my benchmarkLanguagePrimitives.HashCompare.GenericEqualityIntrinsiccallWould you be in favor to change
List.containsimplementation to?
Which turns out fastest from variants I tried. (In benchmark it is
List.containsTryFind).I can extend benchmarks with more cases if needed.
I can make PR for this.
--
Note:
Benchmarks was done on