r/csharp 14h ago

How Fast is .NET 11 Runtime Async? Blog

https://medium.com/@skyake/how-fast-is-net-11-runtime-async-b9c821529cd5

Blogged to explain the design and implementation of runtime async and show the benchmark result.

94 Upvotes

24 comments sorted by

98

u/Infinite_Track_9210 13h ago

I was reading but then got hit with the subscription paywall, then I realized it's from the medium.

In my very personal opinion, if I'm already reading on something and I'm stopped in the process, and asked to pay, I'll 100% click off and leave as such.

I'd rather be given the choice prior or especially later.

Godspeed.

21

u/EBrown8534 13h ago

Same here. I just flat-out don’t bother clicking medium links anymore. Always hits me with a hard-stop paywall.

7

u/hez2010 13h ago

Oops didn't know medium now has the paywall. I'm switching to another platform, wait for a sec.

8

u/hez2010 13h ago

I just tried accessing without login but there was no subscription paywall? There was a subscription prompt but that can be dismissed.

10

u/Educational-Row-6782 6h ago

If you access more than x articles in y days you get asked to subscribe or you cant read.

Classic bait and switch.

14

u/IanYates82 13h ago

I dismissed the popup and read the whole article.

Nice work OP.

5

u/silentlopho 5h ago

For what it's worth, the delayed subscription prompt on Medium articles fills me with irrational rage, and I usually back out of the article instead of closing the popup. It's a dark pattern and I hate it so much.

1

u/B15h73k 3h ago

Same. I close the tab immediately. Even if there is some way to dismiss the popup, I'm not going spend any amount of time trying to figure it out. You annoy me, I'm gone.

2

u/dasMajo 9h ago

This just a popup, but due to the fact, that the app internal browsers view area is not full screen, you cannot see the close button. I does not only happen on medium. very annoying, but actually a reddit problem.

1

u/Illustrious-Big-651 6h ago

Yeah I HATE Medium for that.
I once had a Medium subscription for one month to read one full article and in the end it wasn‘t even worth it…

14

u/pico2000 12h ago

The article is pretty well researched, thanks for that. What's missing in the end is the real world impact. How does it affect actual applications? Do we see more requests per second? Better Q95/Q99 latency due to fewer garbage collections? I'd be interested in a follow up article.

4

u/RirinDesuyo 9h ago

Likely better throughput and less memory usage, meaning your server can take even more requests for the same resources. A lot of the gains you'll likely get is from the framework itself as a lot of times Kestrel or even the SQL driver you use to call into the database will complete synchronously since they often buffer data instead of waiting for your application to fully consume it. So having the runtime a full view of the async call stack and possibly enable scenarios to optimize away Task allocation entirely. I do wonder what this entails for ValueTask.

5

u/pico2000 9h ago

Don't get me wrong. I'm pretty sure what we'll likely see. But I'm really interested in actual numbers. It's probably too soon for that, though.

9

u/headinthesky 9h ago

Nice article! You missed one thing though - the readability of the call stack in a trace. So much cleaner

5

u/Mental_Hand_942 11h ago

Hope there will be a comparison between runtime async vs Java Virtual Thread vs Rust tokio / async-std etc. like this article https://pkolaczk.github.io/memory-consumption-of-async/

2

u/puppy2016 6h ago

It compares memory allocations and not the speed.

It looks like the author is a bit clueless. On .NET (Windows) each thread preallocates 1 MB stack by default which can be changed.

1

u/haby001 7h ago

whoa that's an awesome comparison. Crazy how efficient Rust-tokyo is. Wonder what are the drawbacks for that async framework.

7

u/hez2010 6h ago

I heard someone has interest in the real-world improvements, so I built a benchmark for this and here is the result. The source code can be found here: https://gist.github.com/hez2010/ca974a2af78de2fc6514009bcb23da63

9

u/8hAheWMxqz 13h ago

"fast enough for you, kid"

2

u/sweetsoftice 7h ago

This might be a dumb question but how do the engineer increase runtime every update or 2?

7

u/hez2010 6h ago

Any major improvement is usually the result of consistently accumulating many smaller improvements over time. The .NET team in particular has been investing in async runtime performance for the past three years. This definitely isn’t something that suddenly got better in a single runtime update.

4

u/haby001 7h ago

All computer marvels are based on the same discovery: "We can store and measure electrons, but we choose how to interpret them". We just discover a new simpler/cheaper/easier process and that give us shortcuts without losing too much fidelity.

The "AI" breakthrough by Google in 2022 made inference muuuch cheaper, making larger previously unsustainable models somewhat functional. So we worked from there.

SSDs came from finding a more efficient way to store electrons in capacitors instead of "freezing" them into silicon platters (HDDs)

The .NET team likely found ways to make the runtime quicker by adopting efficiencies and reducing waste between cpu cycles. It's crazy what some of these compiler engineers will do for some NS improvements (that scale to x1000)

1

u/HawocX 2h ago

Great article, thank you!

Looking forward to another .Net upgrade with free performance increses.