1/ True, I confused with List.Find https://referencesource.microsoft.com/#mscorlib/system/collections/generic/list.cs,420

2/ Can you share the code of your Benchmark?

The one I ran:

[MemoryDiagnoser]
public class DelegateBenchmark
{
[Benchmark]
public bool Lambda()
{
return Invoke(i => Filter(i));
}
[Benchmark]
public bool MethodGroup()
{
return Invoke(Filter);
}
public static bool Invoke(Predicate<int> method)
{
return method(42);
}
public static bool Filter(int value)
{
return value % 2 == 0;
}
}
BenchmarkDotNet=v0.12.0, OS=Windows 10.0.18363
Intel Core i7-5820K CPU 3.30GHz (Broadwell), 1 CPU, 12 logical and 6 physical cores
.NET Core SDK=3.1.300-preview-015135
[Host] : .NET Core 3.1.2 (CoreCLR 4.700.20.6602, CoreFX 4.700.20.6702), X64 RyuJIT
DefaultJob : .NET Core 3.1.2 (CoreCLR 4.700.20.6602, CoreFX 4.700.20.6702), X64 RyuJIT
| Method | Mean | Gen 0 | Gen 1 | Gen 2 | Allocated |
|------------ |----------:|-------:|------:|------:|----------:|
| Lambda | 2.115 ns | - | - | - | - |
| MethodGroup | 10.529 ns | 0.0082 | - | - | 64 B |

Written by

Software developer passionate about .NET, performance, and debugging

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store