© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
Why lambda is faster than other approaches? - C#
C
C#
•
16mo ago
•
9 replies
Green Leaf 🦄
Why lambda is faster than other approaches?
I
've been working on some algorithm and discovered that if the
Sort
Sort
function uses a lambda comparer
, it is faster than if it uses a comparer type
. So I run this test with BenchmarkDotNet and the result really puzzles me
. Why is that
?
https://gist.github.com/laicasaane/d51193a0a4aff7c6df6c1bb89a66bdc9
Gist
Test Sort with lambda, local function, comparer type
Test Sort with lambda
, local function
, comparer type
- Result
.log
C#
Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
62,470
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
✅ BDN: ValueTask.AsTask() faster than ValueTask?!
C
C# / help
2mo ago
which is faster
C
C# / help
3y ago
✅ Is there a more efficient way other than ConcurrentQueue?
C
C# / help
8mo ago
✅ My other post is closed idk why but
C
C# / help
2y ago