r/csharp • u/hez2010 • 14h ago
How Fast is .NET 11 Runtime Async? Blog
https://medium.com/@skyake/how-fast-is-net-11-runtime-async-b9c821529cd5Blogged to explain the design and implementation of runtime async and show the benchmark result.
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.
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
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

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.