8 ms·
.NET 7 introduces Native AOT
- goodguyamerikan 4y agoIf powershell starts up instantly, I'll have to say goodbye to zsh
- gmueckl 4y agoI don't think PowerShell is able to use Native AOT compilation. The blog explicitly states that loading extra code at runtime is not possible, but AFAIK this is required for PowerShell commandlets.
- pjmlp 4y agoI never cared about the start time of a shell. What really bothered me were the IBM RAD Studio for Websphere 5.x start times back in 2005. Now the few ms that PowerShell takes? I can live with that, no need to go for breakfast while devenv is booting up.
- moogly 4y agoC:\dev> (Measure-Command { pwsh -c exit }).TotalMilliseconds 1394.1826 C:\dev> (Measure-Command { pwsh -noprofile -c exit }).TotalMilliseconds 247.4816 Non-cold start on a 14-core Skylake-X. Drives me nuts.
- pjmlp 4y agoIf you are restarting your PowerShell session all the time, you must be really busy. /s
- DeathArrow 4y agoOn mine: (Measure-Command { powershell(Measure-Command { powershell -c exit }).TotalMilliseconds 768.5885 (Measure-Command { powershell -noprofile -c exit }).TotalMilliseconds 113.3157
- animesh 4y agoOn an i7-8700 w Kingston NVMe: PS C:\Users\me> (Measure-Command { pwsh -c exit }).TotalMilliseconds 265.3785 PS C:\Users\me> (Measure-Command { powershell -noprofile -c exit }).TotalMilliseconds 119.481
- kaba0 4y agoWhy isn’t there a constantly running daemon, making the actual binary run as a shell be a tiny executable doing some network calls only?
- goodguyamerikan 4y agoThere was a discussion around that but that was scuttled because aot was com inng up
- sebazzz 4y agoIt does. Try using a different anti-malware solution instead, or check which Powershell modules are loaded automatically in your session.
- frabert 4y agoNative AOT is a great concept, I was hoping to use it to build VSTs and other kinds of music plugins without having to deal with C++, since the binaries it produces can export symbols. The stopper I found was the abysmal debugging support, I hope that has improved in the meantime.
- andygocke 4y agoThanks for the feedback! If you have some details and want to post them on https://github.com/dotnet/runtime https://github.com/dotnet/runtime, we can include them in planning. As you might have guessed, this is a pretty huge long-term project and many things basically need to be rebuilt from scratch in order to be supported. Debugging is one area where the form factor will likely demand different behavior vs. JIT, so it will be an evolving scenario. It would be great to know what you would expect vs. what you saw, and importantly what you expect to be different from a traditional native debugging experience (like in C++).
- bob1029 4y agoCouldn't you test plug-ins with JIT? Seems like only some minor performance caveats would apply. Tiered compilation would kick in on hot paths after a while.
- Shadonototra 4y agoyou don't want any slowdown introduced by a JIT compiler when you deal with audio you want consistent perf, AOT makes more sense over there Unity game devs for example had to fight with the mono JIT by warming up their gameplay code otherwise it'd introduce micro stutters
- SemanticStrengh 4y agothis is a myth, AOT is generally slower than JIT for high level languages. Yes though prewarming is underused and important see e.g. https://github.com/facebook/nailgun https://github.com/facebook/nailgun
- viraptor 4y agoThe size improvement is going to be really interesting to me. Currently I have to choose between shipping small Framework 4.8 apps, or the whole kitchen sink with .net 6 even for a trivial wpf+ef app. Trimming and readytorun did not produce significant improvements unfortunately.
- smcl 4y agoI haven't done much desktop/UI work but don't the small Framework 4.8 apps rely on the proverbial kitchen sink being pre-installed on a user's machine? Because afaik this is also possible with newer .NET [Core] applications, and indeed is the default. You just also have the option to publish and distribute a larger bundle which includes the runtime + required libraries.
- viraptor 4y agoCorrect. The difference is that 4.7/4.8 came preinstalled on win10 for years now. It can be uninstalled so you can't really rely on it, but... 99% of the time it works. If not, you tell the customer to install it. https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/versions-and-dependencies https://docs.microsoft.com/en-us/dotnet/framework/migration-...
- RachelF 4y agoI also had no luck with trimming.
- electroly 4y agoThe UI frameworks are hopelessly interlinked. I can't even get it to trim out WPF from an all-WinForms app. I don't have any hope that this will improve substantially for desktop apps; I'm sorta just happy they're still supporting our desktop UI frameworks at all.
- DeathArrow 4y agoWPF and Web Forms are almost dead. Now MAUI is taking over. I hope this one won't be dead, too, in a few years.
- Shadonototra 4y agoThe way to go, i wonder why it took them so long to have such feature, everyone around me is using Go, part of the reason why is single native static binary It's mind boggling that they are just now waking up, not having it makes it impossible to choose and recommend dotnet when your requisite is to be able to have something "tiny", fast and ready to go (no cold start, no runtime dependencies) We talk a lot about Go, but Java had it for years with GraalVM, it should have gave them a hint Of course there was alternative solutions for native AOT, but nothing as easy and integrated as: dotnet publish
- klibertp 4y ago> It's mind boggling that they are just now waking up It's nothing unusual. Software engineering as a field moves at a glacial pace. I see two reasons for this: one is that people don't want to learn anything radically different from what they know already, so you need generational change for new ideas to have a chance to come to fruition. It's a 10-20 years cycle. Then the other reason is that we basically don't know what we're doing, and so some of the new ideas are terrible in practice, reinforcing the first reason. How long did it take for mainstream languages to start seeing `null` as a problem and getting Option types? Depending on who you ask, it'll be 20-30 years; Haskell and other MLs had it either from day 1 or after inventing monads and Maybe (I'm not sure here), and Haskell introduced monads in early '90s. So it's at least 20 years since then, and yet we still have NullPointerExceptions here and there...
- maccard 4y ago> Software engineering as a field moves at a glacial pace. What other industries have you worked in that move faster than software? My experience is that the rate of change is so high and fast in so many areas it's impossible to keep up. Meanwhile in other industries version control still hasn't even gotten as far as track changes in word!
- klibertp 4y ago> My experience is that the rate of change is so high and fast in so many areas Yes. The rate of change is very high. Real, actual improvements, however, are very rare. Most of the code written today in Python - my field of expertise - is written almost exactly the same way it was since 2.4, when I started using it. C10k problem[1] is known for 20+ years already, yet Python only recently got async/await - a proven, very old technique often used for addressing the problem. I learned Rust earlier this year, and they also introduced async/await very recently. pg wrote about the technique in his "On Lisp" sometime in the '90s, so it probably was well known way before that. Scheme and Smalltalk, having reified call stacks in their respective ways, supported concurrency with lightweight threads since '80s. Now you hear about Crystal introducing fibers and how great they are. Yes, they are - and were, for the past 40 years. Rediscovered, and reimplemented, again, because nobody cares about the history of the field, everyone just wants to build their own thing, and solving puzzles is more fun than studying and then standing on the giants' shoulders. Yes, git is a nice VCS, but to be honest - Subversion wasn't that bad, either. NetBSD still uses CVS for versioning and developing its packages. Yes, being able to work without a central server is an improvement, but then again: everything is hosted on Github, a central server, anyway. Some terminal emulators experiment with displaying inline images. The new ones, Kitty and its ilk. First, they try to improve the protocol designed for teletypes in the '60s (IIRC), then they give up and introduce non-standard extensions, which limits their reach and usefulness. But then again, Kitty is hardly the first attempt - IPython qtconsole is also ~15 years old, and a decade before that TCL tried the same thing (with some success I hear). One possible solution to the expression problem, namely multiple dispatch / multimethods, is a selling point of some new languages, like Raku, Nim, Clojure, and of course Julia. Multimethods are known since the '70s, too, yet not even one mainstream language has them as a feature. There's a lot to be said about the churn on the Web, and I don't want to go there, but from the outside perspective, the only real change that happened sometime in the last decade was Let's Encrypt becoming CA. IPv6 adoption is the same as always, and we still need NAT traversal techniques that we used in the '90s. Other than that, everything people do with JavaScript was already done and tested decades ago. I mean, virtual DOM? That's basically what X windows are, and every other GUI out there does it, with invalidating objects and redrawing only obscured/damaged parts of an object, with double buffering to avoid flickering. The shadow DOM and web components - though I've no idea how widely they are used - make the same promise that vendors made when shipping widgets as DLLs to Object Pascal, later renamed Delphi. The only real progress, other than adopting HTTPS everywhere, was ditching Flash, ActiveX and Java applets. It really tells a lot that the most impressive progress happened because of removing something instead of adding. There's a lot more. I don't want to dismiss the great work of a great many fabulous programmers. The progress is happening at all thanks to them. The average developer, however, is average, and does not have knowledge and skills to write something actually game-changing. They try all the time, though, because it's fun, and then the hype and mob mentality takes over on social media. You could say that machine learning was a great development, but then again - neural networks were described in the '70s. It just so happened that massively parallel GPUs were a good way to speed up otherwise very demanding computations. Computation, might I add, mostly done in Fortran (blas, lapack), to this day. I don't want to dismiss the progress we're seeing. I just wish programmers would actually, seriously study the history of our field before going off to create yet another framework. Despite being short, the history of our field is littered with incredible amounts of prior art, and improving upon that should be the goal, I think, not "rethinking and reimplementing" everything from scratch every 10 years. EDIT: I forgot to answer your question: I only worked with software for all my life, I can't say anything about any other field. Most of them, though, have centuries or millennia of history, and they seem to efficiently manage that legacy, turning it into productivity. Maybe there's less objective need for change there, or in some cases the change is impossible due to regulations? Fields that came into being due to the IT revolution seem to be similarly stuck in change-without-progress cycles. Some social activities are like this, too. It might be simply a feature all young fields have. I'm guessing a lot of early airplanes crashed, some of them because of problems that were solved already elsewhere, but without anyone else knowing. The number/rate of failed software projects is staggering, just as a lot of early flying ended with a crash. I'm not sure there's a meaningful correlation, and I'm way outside of my expertise when talking about planes, but I can't help seeing our field as immature and moving very slowly forward. The blessing in disguise is that this time around, failed project doesn't often mean someone died. [1] https://en.wikipedia.org/wiki/C10k_problem https://en.wikipedia.org/wiki/C10k_problem
- RachelF 4y agosurely this headline could be re-written as ".NET 7 introduces compilation"?
- meijer 4y agoThere has always been compilation to byte code in .NET.
- pjmlp 4y agoAnd to native with dynamic linking via NGEN at installation time.
- smcl 4y agoNot really - it already compiles C#, F# and VB.NET to .NET bytecode, which can be JIT compiled by the runtime to some optimized native code as the program runs. It's just that the native code can now be produced by the .NET SDK during the initial build ("ahead of time").
- RachelF 4y agoSo can it compile to native machine code as an executable file, link in all the needed libraries and just run as-is now? Or does it need a huge amount of supporting .NET libraries included also installed on the target?
- smcl 4y agoCheck the docs out: https://github.com/dotnet/runtime/blob/main/src/coreclr/nativeaot/docs/compiling.md https://github.com/dotnet/runtime/blob/main/src/coreclr/nati... Seems to be the case that you just need to install the Microsoft.DotNet.ILCompiler package, and then `dotnet publish...` with the desired target.
- pjmlp 4y agoCough, NGEN, MDIL, .NET Native and Xamarin.
- SemanticStrengh 4y agoAs a reminder, Java supports binaries just fine with GraalVM
- SemanticStrengh 4y agoI really appreciate the rate of optimizations going on in .NET, I feel like openjdk focus less on optimizing codegen and intrinsics (although it does it well compared to other languages). I even speculate C# will reach a point where it will be faster than real world C++ code in many cases. One reason being that GCC/LLVM have mostly stalled performance wise, with only ~1% increment per years (except in very specific cases), and the JIT model should be superior IMHO, I don't understand why JITs can't have a long AOT passe just like LLVM and switch to runtime JIT opts/deopts only if it is superior. This will happen, the question is when?
- mbrodersen 4y ago> I even speculate C# will reach a point where it will be faster than real world C++ code in many cases Don’t hold your breath. The Java community has been trying to do that forever and no cigar. C/C++ is still the #1 language for high-performance software. Developers who hasn’t worked on high-performance software always underestimate how hard it is to compete with C/C++ when it comes to raw performance. Which is why new high-performance projects are started every day using C/C++.
- SemanticStrengh 4y agoIt depends https://news.ycombinator.com/item?id=25217270 https://news.ycombinator.com/item?id=25217270
- mbrodersen 4y agoJava is only as fast as C/C++ if you completely avoid creating objects. It is the ability to manipulate raw data in a cache optimum way and without the Java/C#/… imposed overhead that makes C/C++ fast. Trading doesn’t touch much data so I am not surprised that Java is OK there.
- pjmlp 4y ago.NET still has some catch up to do with JVM eco-system (there is more than OpenJDK out there) in tiered compilation, JIT caches, automatic vectorization (Intel contributed AVX support), devirtualization. It already happened, that is what JIT caches with PGO feedback are all about, available out of the box in Android (yeah I know it isn't really Java), OpenJDK since version 9, OpenJ9 since ages, and on commercial JDKs like PTC, Jamaica, J/Rockit, since begining of the century. .NET introduced PGO feedback around .NET Framework 4.6, but until now it has been quite hard to make use of, and there are some improvements coming up on .NET 7 to make it more automatic without the need to explicitly call some runtime APIs.
- fwsgonzo 4y agoIf this can produce static executables on Linux we may have a winner. We are in the process of selecting a language for $product and we need to pick one everyone is happy with, that boils down to static ELFs. My pick would have been Nim or perhaps ChowJS if it works like they say it does, but it would be even nicer if C# was a possibility. Basically "ldd $file" needs to say "not a dynamic executable". Also, no dlopen().
- jeroenhd 4y agoCurrently, dotnet is able to build binaries for Linux that only depend on the following libraries (hello world app, according to readelf -d): - libcstdc++.so.6 - libm.so.6 - libgcc_s.so.1 - libc.so.6 You can also exchange some dependencies by compiling with profile linux-musl-x64 instead of linuxe-x64 (no libc, no libm, but with libc.musl-x86_64.so.1) to shrink everything down to the bare minimum. While this isn't a completely statically linked executable, I think it's all you need for most distributions. The important part is that you don't need to install any runtimes on the remote machine to run the executable. I'd love for dotnet to also get static compilation options to get rid of the last few dependencies but when your goal is to just distribute the binary so others can run it, I think dotnet is already there.
- pjc50 4y agoIt's remarkably hard to ditch dynamic loading completely when using GNU libc, even when writing directly in C. A surprising range of POSIX functions require it - anything touching usernames, for example, requires it in case it's running on a complex PAM setup.
- SemanticStrengh 4y agoWhy not Java/Kotlin AOT via GraalVM ?
- lmm 4y agoBecause it's a massive complex pile of underdocumented flakiness? Although I imagine this will be to start with too.
- qualudeheart 4y agoThey should have JIT compilation for excel and for whatever that Microsoft scripting language is called.
- jbverschoor 4y agoNative AOT.. the promise that was made 25+ years ago in Java. Of course .NET was a licensing issue of Java, so this counts
- andwoe 4y agoI guess you haven't heard about GraalVM Native Image yet, then.
- pjmlp 4y agoAnd delivered to anyone with bucks to spare on a commercial JDK, Excelsior JET being one of the earlier ones.
- jbverschoor 4y agoMan Excelsior JET that's such a long time ago. Totally forgot about them, never really had good experience with it though.
- snth 4y agoWill this work for F#?
- pjmlp 4y agoYes, contrary to what happened with .NET Native, in Native AOT they take care of all MSIL opcodes.
- DeathArrow 4y agoIt should work for all .NET languages.
- DeathArrow 4y agoNow, if they would also introduce a way to disable GC and do manual memory management, C# could tackle more systems programming, too, becoming the supreme Jack of All Trades. It's used for: backend, desktops, frontend (with Blazor), desktop, mobile and even microcontrollers.
- WorldMaker 4y agoSpan<T> and friends is having manual memory management cake and eating it in a GC managed world too. So far as I'm aware they weren't directly "designed for" systems programming, but there's a growing impressive body of work that a lot of the benefits to raw memory management and "pointer arithmetic" you can get from type safe stack-only "borrowable" functors in a GC language/environment. Span<T> and its friends don't cover every scenario you might wish for "serious" systems programming, yet, but I wouldn't be surprised if the slow weird convergence with Rust borrow mechanics eventually makes C# look like a good option for systems programming, too.
- pjmlp 4y agohttps://www.wildernesslabs.co/netduino https://www.wildernesslabs.co/netduino https://www.wildernesslabs.co/ https://www.wildernesslabs.co/ https://docs.microsoft.com/en-us/dotnet/api/system.gc.trystartnogcregion?view=net-6.0 https://docs.microsoft.com/en-us/dotnet/api/system.gc.trysta... https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.nativememory.alloc?view=net-6.0 https://docs.microsoft.com/en-us/dotnet/api/system.runtime.i... https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.marshal?view=net-6.0 https://docs.microsoft.com/en-us/dotnet/api/system.runtime.i... Go have fun!
- SemanticStrengh 4y agoalways has been
- rkagerer 4y agoThis headline cracks me up. I recognize it traditionally produced MSIL and this is a big breakthrough, just feel like the feature is kind of the whole point of a compiler.
- WorldMaker 4y agoMSIL is the machine language of a virtual machine. It's still compiling to a machine language, even if the machine is "virtual".