News for hackers. Stuff that matters.
Re:.NET 6 vs .NET 5 speedup by luan42 on Sunday November 21, 2021 @06:28PM (#29300853)
> - Use LINQ cautiously as its variants are mostly slower than explicit coding. E.g. .Any() vs .Count == 0

Is this really true for the example? To me it seems that the implementation for .Any actually uses .Count when available, see https://github.com/dotnet/runtime/blob/main/src/libraries/Sy...

Re:.NET 6 vs .NET 5 speedup by notanaverageman on Monday November 22, 2021 @01:21AM (#29303414)
Any method does an extra null check and a cast to ICollection<T> which incur unnecessary performance degradation. Of course this is in micro optimization scale. If you do not call Any() on a hot path it does not matter which one you use.