this post was submitted on 16 Jun 2023
33 points (100.0% liked)

Programming

17000 readers
259 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
top 27 comments
sorted by: hot top controversial new old
[–] [email protected] 20 points 1 year ago (1 children)

Is this programming humor?

[–] [email protected] 2 points 1 year ago (1 children)

Which languages with a full runtime and memory management are in the same ballpark? Go, maybe? Obviously these are unimpressive figures for unmanaged languages.

[–] [email protected] 1 points 1 year ago

Nim can compile helloworld to 800 Kb (or, with some tricks, to 50 Kb). This includes static linked libc, garbadge collection, nim std/system, and no compression.

[–] [email protected] 11 points 1 year ago

To demonstrate the OS's capability and relatively small size, in the late 1990s QNX released a demo image that included the POSIX-compliant QNX 4 OS, a full graphical user interface, graphical text editor, TCP/IP networking, web browser and web server that all fit on a bootable 1.44 MB floppy disk for the 386 PC. https://en.m.wikipedia.org/wiki/QNX

[–] [email protected] 10 points 1 year ago (1 children)

On the one hand, if it's genuinely self-contained (that is, it doesn't expect a .Net runtime to have been preinstalled on the OS), that may well constitute an improvement over previous iterations of C#.

On the other hand, the smallest executable I can find on my system occupies 6K and actually does something useful.

On the third hand (said the octopus), if all we cared about was executable size and efficiency, we'd still all be coding in assembler, or at least C or Forth.

[–] [email protected] 3 points 1 year ago

Before trimming and aot it was in the region of 100mb so it's an insane improvement from a few version ago.

[–] [email protected] 8 points 1 year ago (1 children)

This is pretty awesome and it shows how far .NET has come in recent years.

[–] [email protected] 1 points 1 year ago (1 children)

Is this supposed to be small or am I missing something? 400kb for hello world does not really sound small

[–] [email protected] 10 points 1 year ago

It is really small for a platform like .NET.

[–] [email protected] 5 points 1 year ago (1 children)

Is someone else silently crying when remembering the demo scene...?

[–] [email protected] 6 points 1 year ago (1 children)

Every demoparty in the link you mentioned with a beginning date and a dash but no end date is still happening. The demoscene is still very much alive.

[–] [email protected] 3 points 1 year ago

Oh yes! And I didn't intend to say it is dead! I merely wanted to point to the fact that these guys did and do incredible things in the 64kb class.

[–] SirShanova 4 points 1 year ago (1 children)
[–] [email protected] 5 points 1 year ago (2 children)

hh3tf.golden.exe is 1536 bytes, compiled from C, and comes with a comma and exclamation point:

I'm actually surprised it's that large, but Windows gonna Windows.

[–] [email protected] 1 points 1 year ago (1 children)

You can get even lower! hello world in 512 bytes:

f0VMRgIBAQAAAAAAAAAAAAIAPgABAAAAsABAAAAAAABAAAAAAAAAAAABAAAAAAAAAAAAAEAAOAAC
AEAABAADAAEAAAAFAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAA1QAAAAAAAADVAAAAAAAAAAAQ
AAAAAAAAAQAAAAYAAADYAAAAAAAAANgQQAAAAAAA2BBAAAAAAAAOAAAAAAAAAA4AAAAAAAAAABAA
AAAAAAC4AQAAAL8BAAAASL7YEEAAAAAAALoOAAAADwW4PAAAAEgx/w8FAAAASGVsbG8sIFdvcmxk
IQoALnNoc3RydGFiAC50ZXh0AC5kYXRhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAYAAAAAAAAAsABAAAAA
AACwAAAAAAAAACUAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEQAAAAEAAAADAAAAAAAA
ANgQQAAAAAAA2AAAAAAAAAAOAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAEAAAADAAAA
AAAAAAAAAAAAAAAAAAAAAOYAAAAAAAAAFwAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAA=

And I'm sure even lower, look at all those zeros! and that stupid header

[–] [email protected] 3 points 1 year ago* (last edited 1 year ago)

or even better, hello world in also 512 bytes but without an OS!

+r4QfLQOrAjAdATNEOv39EhlbGxvLCBXb3JsZCEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVao=

So much empty space lol
from https://blog.ghaiklor.com/2017/10/21/how-to-implement-your-own-hello-world-boot-loader/

[–] SirShanova 1 points 1 year ago

Such is life!

[–] TCB13 -2 points 1 year ago (1 children)

What do they mean by "fully self-contained natively compiled C#"? Some executable that depends on specific update Windows versions and 30 different .net frameworks installed on the system? :D

[–] [email protected] 11 points 1 year ago* (last edited 1 year ago) (1 children)

I might be missing a joke? but they are referring to NativeAOT, aptly named as it compiles a .NET application into a native binary ahead of time (instead of using a JIT.) The benefit being no dependency on the .NET runtime, faster startup time (but slower runtime performance, due to lack of JIT), lower memory footprint, and any other advantage you'd find in Go.

[–] TCB13 5 points 1 year ago (2 children)

The question is, how good is NativeAOT comparable to a static binary from C++ or Go? As we both know Microsoft has a very poor track record when it comes to static builds / "self-contained" stuff. My question was mostly satire but I still would like to know how "self-containted" are those applications.

Does it effectively output a single binary? Does it create some kind of clusterf*k and awkward packaging formats like other MS solutions such as UWP? Will it actually be deployable to a random fresh install of Debian 12 or Windows 10? What about compatibility with older systems?

[–] [email protected] 8 points 1 year ago* (last edited 1 year ago) (1 children)

Does it effectively output a single binary?

Yes, that's one of the points of NativeAOT, a self-contained single binary, exactly as Go does it.

Does it create some kind of clusterf*k and awkward packaging formats like other MS solutions such as UWP?

No, you can create .exe files.

Will it actually be deployable to a random fresh install of Debian 12 or Windows 10?

Yes, NativeAOT supports Windows, Linux and MacOS, x64 and Arm64.

What about compatibility with older systems?

Not sure about that, I suppose it depends on the targets each .NET version support. For example, .NET 8 will drop RHEL 7 and only RHEL 8 and later.

And to play devil's advocate: this won't work for all existing .NET applications. If you use reflection (which is AOT unfriendly), chances are that you will have to rework a ton of stuff in order to get to a point where NativeAOT works. There's a middle solution though, called ReadyToRun, which has some advantages compared to running fully with the JIT compiler.

[–] TCB13 -3 points 1 year ago (3 children)

Thank you for the link, so --self-contained will results in "a folder that has our exe and everything that is required to run it (...) a little over 200 files" while /p:PublishSingleFile=true will result in a 70MB file for a simple hello world. This kind of confirms my cheap satire :D it is nice this is an option now but the mess and size is crazy. Statically built Qt programs for Windows, with a GUI, are usually around 10MB for a simple app.

[–] TexasCrowbarMassacre 6 points 1 year ago

I’m pretty sure that 70MB is including the entire .NET standard library, which is massive. Enabling NativeAOT or trimming reduces the size down to a few MB

[–] [email protected] 5 points 1 year ago

My bad, the link I sent was not about NativeAOT, just bundling all the dependencies together (also, it's 4 years old). After a quick search, here's a recent SO question that mentions that you can build .exe files

As for the filesize... please recheck the post under which we are commenting. :D

[–] PixxlMan 3 points 1 year ago (1 children)

I just don't get the obsession with small executable file sizes. 100 MB here and there hasn't mattered at all in desktop development for many years. Feels like arbitrary goals set up just to be able to say "look there are still uses for [unmanaged language]". And of course there are, but a 60 MB smaller executables on a desktop with several terabytes of storage just isn't one of them. And no, developer, about to comment about how you've only got 5 millibits of storage on your embedded system, we're not talking about that.

[–] TCB13 2 points 1 year ago

Simple, larger binaries = more time to load into memory. Why over complicate things that could've been made way simpler?

[–] [email protected] 2 points 1 year ago

It's a single executable that runs with no dependencies.

load more comments
view more: next ›