4 ms·
I think a standalone "Hello World", built with .NET Core, is around 60-70 MB large on both Linux and Windows. The startup times are alright - slower on Windows
by pca 5y ago
I think a standalone "Hello World", built with .NET Core, is around 60-70 MB large on both Linux and Windows. The startup times are alright - slower on Windows than on Linux in my experience because of the file system performance.
- arboghast 5y agoLower than this. If I use the AOT compile option with .NET Core 3.1 I get a 40MB binary which goes down to 10MB with the trim option. Just like Go which embed it’s runtime, .NET Core binary compiled with AOT embed the CLR but, unlike Go, it has options to trim out the pieces that aren’t necessary, which I really like.
- formerly_proven 5y agoIf you use legacy .NET (which is preinstalled on Windows) a GUI Hello World is about 10 kB.
- chrisseaton 5y ago> I think a standalone "Hello World", built with .NET Core, is around 60-70 MB large on both Linux and Windows. Lol what? What goes into a 70 MB implementation of 'hello world'?
- deleted 5y ago[deleted]
- Kwpolska 5y agoIt’s not a 70 MB implementation of Hello world. It’s a 70 MB compressed runtime with a standard library (or at least the most basic parts of it) and a couple KB "Hello world".
- chrisseaton 5y agoWhy is the runtime so huge and why is so much of the standard library included? Java ‘hello world’ compiled into a static binary is just a couple of MB.
- pjc50 5y agoSee PublishTrimmed: by default it includes all the standard library. "Trimming" is what almost all C-style linkers do by default, but C# doesn't because there are some reflection issues (e.g. you can reference types by strings and construct them at runtime, which would fail in a Trimmed environment unless you explicitly tell it not to trim those types).
- older 5y agoCan this couple MB static binary run without JRE?
- chrisseaton 5y agoWell it wouldn't be very 'static' if it couldn't, so yes of course.
- older 5y agoCould you point me to where I can learn how to do it?
- mastax 5y ago