| ▲ | esafak 6 months ago | |||||||
2.2MiB for "Hello, World"? I must be getting old... The executable takes 33KB in C, 75KB in nim. | ||||||||
| ▲ | koito17 6 months ago | parent | next [-] | |||||||
By switching to e.g. musl, you can go down to a single megabyte ;) But in all seriousness, my example is quite cherrypicked, since nobody will actually statically link glibc. And even if they did, one can make use of link-time optimization to remove lots of patches of unused code. Note that this is the same strategy one would employ to debloat their Rust binaries. (Use LTO, don't aggressively inline code, etc.) | ||||||||
| ||||||||
| ▲ | AdieuToLogic 6 months ago | parent | prev | next [-] | |||||||
Just for fun, I wondered how small a canonical hello world program could be in macOS running an ARM processor. Below is based on what I found here[0] with minor command-line switch alterations to account for a newer OS version. ARM64 assembly program (hw.s):
Assembling and linking commands:
Resulting file sizes:
0 - https://smist08.wordpress.com/2021/01/08/apple-m1-assembly-l... | ||||||||
| ▲ | creatonez 6 months ago | parent | prev | next [-] | |||||||
> The executable takes 33KB in C, 75KB in nim. Did you statically link Glibc...? Or is this with a non-GNU libc? Either way, it probably is true that this 2.2MiB number would be smaller on, say, Debian 5. And much smaller on PDP Unix. | ||||||||
| ▲ | 3836293648 6 months ago | parent | prev [-] | |||||||
We just have large standard libraries now | ||||||||
| ||||||||