5 ms·
Performance Improvements in .NET 11
- bjoli 18d agoI hope there will be some kind of runtime async support for the current or a new asyncmethodbuilder. That is amazing work.
- SideburnsOfDoom 18d agoI'm not sure what you mean exactly? Here is the "Runtime async" section: https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-11/#runtime-async https://devblogs.microsoft.com/dotnet/performance-improvemen... I'm not sure if this will surface as an "enabled by default" feature in .NET 11 - indeed there may not be a final decision on that yet. But it is an active area of work that will arrive sooner or later.
- afdbcreid 18d ago`AsyncMethodBuilder` is a way to declare async methods that return your own task types. AFAIK it is not supported with the current runtime async, and maybe never will be - it's quite hard to support, I believe.
- pjmlp 20d agoAh the traditional browser stress test from the .NET team. :) Joke aside, yet another interesting read of all little improvements that go across all the runtime, and very much appreciated that they put out the effort to go through this detail level.
- equasar 19d agoThanks Stephen for this, it is very rewarding to read something very technical that is not AI slop these days.
- adzm 19d agoRuntime async is certainly an interesting development. Really excited to see how this plays out.
- deleted 18d ago[deleted]
- gerdesj 18d agoSpinal Tap's "put it up to 11". My laptop (Kubuntu) has volume controls that allow me to override 100% and take it to 150%. I can wind it up to 15! \||/ (is there an official ASCII art four finger devil's horns)
- parineum 18d ago\m/
- gerdesj 18d agoI stared at my keyboard for bloody ages and came up with || instead of m. nob end!
- richiebful1 18d agoI noticed that audio quality begins degrading above 100% (at least if the media is already at high volume), so it really is a useful concept. I'm unsure what Linux distro I'm recalling this from, but it was useful on my little old netbook from college
- qingcharles 18d agoThe software has to start clipping the audio above "100%", but I use it regularly in say, VLC, because I might want the volume slightly higher without increasing my whole system volume just to hear a quiet section. I rarely notice any degradation at 150%.
- kristianp 18d ago[flagged]
- pestkranker 18d agoThese comments about potential LLM usage are so boring. Stephen is doing this kind of blog post since 6+ years. They all look the same. Read it! It’s very good. Performance deep dives with this kind of quality are rare.
- deleted 18d ago[deleted]
- kristianp 18d agoOk, fair enough. I may have over compensated for this one. I found the Spinal Tap, "this one goes to 11 stuff" so irritating that I might have not thought it through. It's such a tired joke by now. I did enjoy his Frozen reference last year.
- nitinreddy88 18d agoThis comment is written by AI. "Fair enough" "over compensation" in one line. We should ban such accounts
- gerdesj 18d agoNot too sure here. I use quite a few commas, too. I suspect it was done old school: Written by Stephen and passed to a LLM to fill in all those links and other garnish and then passed back for final polish by Stephen. That's how I do my write ups (but generally without the LLM bit for shorter efforts). This is a long write up, and I'm sure it will have been assisted, but in the right way, and not a sloppy way. I've dropped several commas before conjunctions, soz!
- AlexErrant 18d agoFWIW the .NET 10 release also had 2 occurrences of "real" in literally the first paragraph. I, too, tire of the constant YOU WROTE THIS WITH LLMs outrage. An incredible engineer dumped an ENORMOUS amount of technical knowledge at your feet, and you're commenting on the smell? Is that all you have to contribute? I saw this too on the Ryan Carniato/SolidJS 2.0 announcement post. A world-class engineer makes a great blog post, and all the comments can focus on are the LLM-smells. Oh well. Any reason not to learn, I guess.
- AlexErrant 18d agoDumb Q: should a non-systems-language dev know/read assembly? ; Arm64 --- .NET 10 +++ .NET 11 @@ -13,8 +13,6 @@ ble G_M000_IG04 G_M000_IG03: - cmp w1, w2 - bhs G_M000_IG05 str wzr, [x0, w1, UXTW #2] G_M000_IG04: @@ -25,4 +23,4 @@ bl CORINFO_HELP_RNGCHKFAIL brk #0 -; Total bytes of code 68 +; Total bytes of code 60 I know C#/F# decently well, but is there any reason to actually pull out the ol textbooks and learn wtf the above is saying?
- flowerlad 18d agoNo. If you're a low-level C language programmer then it is useful.
- louthy 18d agoYou don’t need to, but if you ever want to really optimise some code, understanding what it turns into on the target CPU really helps. Especially if you know the implications for any particular instruction (cost of memory access, potential branch prediction misses, etc) The three* letter mnemonics are usually pretty easy to decode, even if you don’t know the architecture: anything beginning with ‘B’ will be branch, so ‘ble’ is branch if less than or equal. L and S based mnemonics are unusually Load and Store from and to memory. After that it’s understanding the stack and registers and you’re pretty much good to go. Everything in assembly is loading something from memory into registers doing something basic with those registers, like add/divide/etc and then putting the result back into memory or using the result to make a decision to jump to processing instructions from another place in memory. Most devs won’t ever need to know this stuff, but as someone who grew up with computers that could barely do anything without grinding to a halt (8bit computer, 2mhz processor, 32kb of RAM, 20kb of which is for the screen), knowing this stuff was essential; however I still find this stuff useful today, even with my C# work. I am a bit of a performance tuning nerd though, so… [*] or more
- masfuerte 18d ago> anything beginning with ‘B’ will be branch Usually. BRK is a breakpoint.
- mlhpdx 18d agoImpressive technical work and authorship. My quibble, which seems significant in context, is what happened with AoT?
- CurtHagenlocher 18d agoAoT is still a thing. Presumably a lot of the JIT improvements would also improve the generation of AoT-compiled code.
- qingcharles 18d agoIt still exists, it's still a bit quirky because of the way you need to match CPU to binary (e.g. some opcode extensions only existing on some CPUs)
- kg 18d agoAoT uses the same codegen (mostly) as the JIT so if you see a JIT improvement it's possible NativeAOT/ilc picked up that improvement too. Unless it's a runtime-only optimization, like guarded devirtualization... there's no straightforward way for an AOT compiler to do that without profiling data.
- drewnoakes 16d agoNative AOT is seeing a lot of use within Microsoft products too. Some bits of the .NET SDK use it, and C# Dev Kit (the C# extension for VS Code) uses it extensively in version 11. It brings a lot of performance to .NET.
- dude250711 18d agoC#/.NET are very well-represented in LLM data - from enterprise back-end code to games. A language to use for sure.
- CharlieDigital 18d agoFlip side: LLMs have to be very explicitly told to code in "modern" .NET and C# due to lack of representation in the training set. Case in point: extension members from C# 14 is one that LLMs commonly stumble on and requires an explicit example. It still sometimes says that this is not valid syntax. extension(SomeType instance) { public OtherType DoSomething() { ... } } Agents really struggle on this one for some reason. Even older releases have a few that I notice LLMs making mistakes on like use of `System.Threading.Lock` over `Object` when locking.
- merb 18d agoWith Claude I never had that problem. However Claude does not use the pattern by default
- oldmanhorton 18d agoThe dotnet team provides some agent plugins which solve some of these issues. I expect unions in dotnet 11 will need some skill updates too.
- qingcharles 18d ago[flagged]
- mexicocitinluez 18d agoI wonder if any of those work alongside Github Copilot (the autocomplete not actual agent). Because at this point I would do anything if I could get Github Copilot to understand the new language features and stop trying to constantly revert code. The one specific thing I'm constantly having to deny is Copilot seeing this: List<string> items = []; into this: List<string> items = new List<string>();
- Sorrel47 18d agoAlways appreciate the continued perf gains. Our existing services just get faster for free, which is a nice win.
- pseudosavant 18d agoVery thorough write up. Clearly a lot of performance improvements across their stack. As if it wasn't detailed/long enough already, I would have loved to see some application-level benchmarks that gave a hint of the cumulative performance gains we should expect.
- d_finch 18d agoSaw a noticeable startup time boost on a recent project migration. Always appreciate the continued focus on speed.
- rsalus 18d agothese blog posts have really turned me into a dotnet evangelist. love the framework & language.
- refactor_master 18d agoToo bad there’s such a lingering culture of Windows and creaky Lenovos and Dells around it. I’m sure it can be different, but I’m not taking my chances ever again. Simply not worth my sanity.
- GiorgioG 18d ago[flagged]
- tomhow 18d agoWe've banned this account for repeatedly posting abusive comments and ignoring our appeals to stop. If you don't want to be banned, you can email us and demonstrate an intention to observe the guidelines. https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html
- GiorgioG 18d ago[dead]
- littlecranky67 18d agoNot sure when your last foray into the .NET ecosystem was, but every since it is xplat and unified (.NET 5 probably) it is a real joy. I use VSCode as IDE for C# on my mac, and deploy to Linux.
- atraac 18d agoHe didn't say you can't use Linux or MacOS, he said there's still a culture of being Windows and Microsoft only across .NET shops. As an ex .NET dev I can confirm, the community is quite close minded, language is awesome.
- tiffanyh 18d agoThis post was so refreshing to read, because it reminds me of a time of solid engineering & writing in a pre-AI era. I’m afraid posts like this might become fleeting.
- Pannoniae 18d agolooks like a large chunk of this was written by claude though :( the technical parts are fresh as ever but the writing style is awful, man
- Scharkenberg 18d agoThe writing style is similar to the other articles by the same author. He has been doing this for years. I have no idea what your problem with the actual content is.
- mpawelski 18d agoidk, it really feels like it was redacted by LLM. At least the content is good as usual.
- Pannoniae 17d agoI've been reading these since the .NET 5 performance improvements blogpost. Again, the content is ever-sharp but the style is so full of claudisms it's next to unbearable to read. I'm not anti-AI by any means, I just find it annoying, that's it really.
- sltr 17d agoAgree. A whole tree of comments agreeing with you is not appearing on this post because that's how HN works. I loathe LLM prose, no matter who posts it. It earns a quick cmd+w. My prizes for spending the internet points to say this are the joy of resisting normalization of illiteracy and a tacit camaraderie with the hundreds of others who agree but won't comment or upvote.
- 17d ago
- lukehoban 18d agoFor anyone who enjoys Stephen Toub’s deep technical articles like this one as much as I do - he also published another post today on migrating the Copilot coding harness from Node.js to Rust. Another great read. https://github.blog/ai-and-ml/generative-ai/migrating-the-github-copilot-runtime-to-rust-using-copilot/ https://github.blog/ai-and-ml/generative-ai/migrating-the-gi...
- momocowcow 18d agocasey muratori would like to have a talk with you about the following :)) // Approximately what the JIT generates if (animal?.GetType() == typeof(Dog)) { ((Dog)animal).Speak(); // devirtualized, inlinable } else { animal.Speak(); // original virtual call, hopefully rare }
- kg 18d agoYou can always just not use OOP. C#'s tooling for functional programming and C-style programming is really good, thanks to stuff like statics on interfaces or spans.
- program_whiz 18d agoactually this is likely just as performant as the "Ugly but fast" code from the famous talk. After all, this is just branching on GetType() == typeof(Dog) which is presumably boiling down to an integer comparison. This roughly the same as the following C code: void speak_generic(void* animal, int type_id) { if (type_id == DOG) { dog_speak((Dog*)animal); } else { dispatch_speak_vtable(animal); } } Advantage 1: You don't have to maintain this logic (its automatic), so you won't get weird cases if you forget to update all your switches everywhere, and/or you get weird fallthrough logic and footgun yourself in C. Advantage 2: You still get the flexibility of the vtable if you need it (for the case the type is chosen at runtime at not known). But for 90% of cases, its just as fast as the ugly C code. Disadvantage 1: Losing a smug sense of superiority because you eschew abstractions and prefer writing verbose error-prone switch statements over clean easy to understand code. Disadvantage 2: Writing performant code can no longer be gate kept behind archaic practices, now everyone can just use `var animal = new Dog()` and be done with it.
- anthk 18d agoOne of the best perf tests for C# it's to run the Switch emulator against some legal Switch demo game dump.
- PrinceJeamvilla 18d agoPlease give me a money with 1,0000
- majora2007 18d agoOutside of the outstanding optimizations .net has made (plus async runtime), what I really enjoyed was the reworked entry section. Stephen reiterated all the concepts from the past Performance Improvement articles to really showcase the layers of optimization techniques and how the can transform.
- ochronus 18d agoAs much as Micro$oft is ... subpar, .NET never fails to amaze in the last couple of years. Kudos to the team.
- someguynamedq 18d agoIt's long
- Woodi 17d agoOh yea... My reading was like this: - "how much things they postpone to put into v11 ?" - "moving to stack is faster then heap" - so.. why they just not use multiple stacks ?? ring buffers are just progressive stack but plain stack is just pointer moving... Hmm, but what is usecase except recursive function calling ? - ok, I read that articele - what ? it's just a first part ?? - async thingies - "state machines looks like that" - aha, always wanted to konw that, thank you Microsoft! Wait, what?? What I just said ?? That really happened? - scroll, then scroll more some asm code, maybe I read it later - something interesting, don't remeber now - next morning coffee time: O, I have some more to read, maybe I can learn something more ? - ok, work time but probably will finish reading later today So it is realy nice article. I learned how to do old-school async wrappers in plain C :)
- jcon321 18d agodotnet has been a pleasure to work with the last few years
- testerius 18d agoI remember .NET fails when there were dramas about not open sourced debugger, planning to remove hot reload (make it only available in Visual Studio because of licensing) or poor support in Visual Studio Code compared to other languages. AFAIK many people were angry that VS Code is not first class editor for C#/.NET. I am not sure how it is these days.
- ozim 18d agoDebugger was there, hot reloading was the issue. Still I take debugger in Visual studio or Rider any day instead of VSCode debugger.
- mpawelski 18d agoThe situation about debugger didn't change really. https://github.com/dotnet/core/issues/505 https://github.com/dotnet/core/issues/505 At least they didn't close the issue... https://isdotnetopen.com/ https://isdotnetopen.com/ has a good list of "dramas" questioning if .NET is truly open. At least there are not many new dramas from Microsoft... For me it's not that big of a deal that some parts are not open. At least we have good competition (Microsoft (Visual Studio, VsCode c# Dev Kit) vs Jetbrais (Rider, VsCode + recent "Resharper for VsCode" extension.) that prevents one party to mess up something big.
- drewnoakes 16d agoC# Dev Kit is also receiving huge performance improvements with .NET 11. It's available now on the pre-release version of the extension, if you want to check it out. Some details in the .NET Unboxed video here https://m.youtube.com/watch?v=5fvi7m1QxIY https://m.youtube.com/watch?v=5fvi7m1QxIY
- deleted 17d ago[deleted]