SO CSharp
81 subscribers
1.43K photos
73 videos
80 links
Some stuff about about software development and related (devops, cs, ai, etc.). Stolen memes (mostly), some rare #random_PoK (random Piece of Knowledge), stream notifications. Also #weekendmeme
Download Telegram
😁4🌚2
Traditional Friday post
Forwarded from SO CSharp
❀5
🀣4😁2
😁3
😁7🀣4
This media is not supported in your browser
VIEW IN TELEGRAM
not a #weekendmeme (Monday is coming 😁)

#suggestion_box #based
🀣4πŸ‘1πŸ”₯1🐳1πŸ’―1
πŸ’―5😁2
Which repo taught LLMs to use emojis in the code?

#based
😁2πŸ”₯1πŸ‘»1
Two bugs - one meme 😁

#microsoft #ai
πŸ‘4😁3
SO CSharp
#sql #query #where
πŸ’―2πŸ‘1πŸ”₯1😁1πŸ—Ώ1
Just finished reading the huge Performance Improvements in .NET 10 article.

There’s a ton of interesting stuff in there, and I might eventually write a β€œsmall” summary of it. But for now, here’s a new #random_PoK (random Piece of Knowledge) :

Finally .NET has dedicated LeftJoin and RightJoin LINQ methods!

No more monstrous GroupJoin + SelectMany + DefaultIfEmpty constructs β€” and for LINQ to Objects, it’s even faster:

[MemoryDiagnoser(displayGenColumns: false)]
[HideColumns("Job", "Error", "StdDev", "Median", "RatioSD")]
public partial class Tests
{
private IEnumerable<int> Outer { get; } = Enumerable.Sequence(0, 1000, 2);
private IEnumerable<int> Inner { get; } = Enumerable.Sequence(0, 1000, 3);

[Benchmark(Baseline = true)]
public int LeftJoin_Manual() =>
ManualLeftJoin(Outer, Inner, o => o, i => i, (o, i) => o + i).Count();

[Benchmark]
public int LeftJoin_Linq() =>
Outer.LeftJoin(Inner, o => o, i => i, (o, i) => o + i).Count();

private static IEnumerable<TResult> ManualLeftJoin<TOuter, TInner, TKey, TResult>(
IEnumerable<TOuter> outer, IEnumerable<TInner> inner,
Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector,
Func<TOuter, TInner?, TResult> resultSelector) =>
outer
.GroupJoin(inner, outerKeySelector, innerKeySelector, (o, inners) => (o, inners))
.SelectMany(x => x.inners.DefaultIfEmpty(), (x, i) => resultSelector(x.o, i));
}

|Method         |Mean    |Ratio|Allocated|Alloc Ratio|
|---------------|--------|-----|---------|-----------|
|LeftJoin_Manual|29.02 us|1.00 |65.84 KB |1.00 |
|LeftJoin_Linq |15.23 us|0.53 |36.95 KB |0.56 |


Also β€” .NET Conf kicks off today!
Don’t miss it: https://www.dotnetconf.net/ πŸŽ‰πŸŽ‰πŸŽ‰
πŸ”₯3❀2πŸ‘1
😁5πŸ‘1
😁6🀣2❀1πŸ‘1
😁3πŸ‘1
😁3πŸ‘1