-
-
Save whiteinge/662e8cd1d361003b34531d9ee3c94197 to your computer and use it in GitHub Desktop.
Default compiler settings used, unless noted otherwise. Host system is Fedora | |
x86_64. Linked libs produced via `ldd`. | |
Linked libs common to all below: linux-vdso libc ld-linux | |
Size Lang Specific libs Common libs | |
18K c - - | |
20K luastatic liblua libm libdl | |
22K vala libgobject libglib libffi libpcre libpthread | |
27K urweb liburweb_http liburweb libm libcrypto libssl libpthread libz libdl | |
31K dlang (ldc2) libphobos2-ldc-shared libdruntime-ldc-shared libm libgcc_s libc | |
31K vlang (-prod) - libm libpthread libdl | |
32K ada libgnat libdl libm libgcc_s | |
34K chicken libchicken libm libdl | |
36K kit - libm | |
37K dlang (gdc) libgphobos libgcc_s libm libc | |
41K C++ - libstdc++ libm libgcc | |
56K ecl libecl libgmp libgc libffi libpthread libdl libm libatomic_ops libgcc_s | |
70K zig (ReleaseSmall) - (not dynamic) | |
70K idris - libgmp libpthread libm | |
83K red libRedRT linux-gate libm libpthread libgdk_pixbuf-2.0 libcurl libgtk-3 libudev libglib libgobject libgmodule libgio libpng16 libjpeg libnghttp2 libidn2 libssh libpsl libssl libcrypto libgssapi_krb5 libldap liblber libbrotlidec libz libgdk-3 libpangocairo-1.0 libpango-1.0 libharfbuzz libcairo libpangoft2-1.0 libfontconfig libfribidi libcairo-gobject libatk-1.0 libepoxy libXi libX11 libatk-bridge-2.0 libcloudproviders libtracker-sparql-3.0 libwayland-client libXfixes libcap libgcc_s libpcre2-8 libffi libmount libselinux libunistring libkrb5 libk5crypto libcom_err libkrb5support libkeyutils libresolv libevent-2.1 libsasl2 libbrotlicommon libxkbcommon libwayland-cursor libwayland-egl libXext libXcursor libXdamage libXcomposite libXrandr libXinerama libthai libfreetype libgraphite2 libXrender libxcb libxcb-render libxcb-shm libpixman-1 libxml2 libatspi libdbus-1 libjson-glib-1.0 libsqlite3 libblkid libcrypt libdatrie libbz2 libXau liblzma libsystemd libzstd liblz4 | |
92K polyml libpolyml libstdc++ libm libgcc_s libpthread libffi libgmp libdl | |
175K vlang - libm libpthread libdl | |
177K cakeml - - | |
208K mlton - libm libgmp | |
320K ocaml - libm libdl | |
374K rust - libgcc_s | |
549K nim - libdl | |
569K zig - (not dynamic) | |
594K janet - libm libdl librt libpthread | |
840K dlang (dmd) - libpthread libm librt libdl libgcc_s | |
1.2M mlton (static) - (not dynamic) | |
1.9M golang - (not dynamic) | |
2.1M chicken ("static") - libm libdl | |
2.6M roc - (not dynamic) | |
2.7M haskell - libm libgmp librt libdl libpthread | |
9.7M sbcl (compressed) - libdl libpthread libz libm | |
12M racket 8 (raco exe) - libpthread | |
38M sbcl - libdl libpthread libz libm | |
42M node-pkg - libdl librt libstdc++ libm libgcc_s libpthread | |
45M node-nexe - libdl libstdc++ libm libgcc_s libpthread |
Zig lang ?
Rustlang ? slightly_smiling_face
Added! I even had rustc
installed so not sure why I didn't think to include it here. The binary is much, much bigger than I expected -- it's on par with some of the langs that bundle their own runtime. Compiled with default settings and no CLI flags so maybe I'm overlooking something. 🤷
Assembly ?
Zig lang ?
Added. Definitely the smallest of the static builds.
Assembly ?
haha. Contributions welcome. 😀
For Zig, once compiled with the -O ReleaseSmall command, it's only 5 KB (tested for windows 64)
For Zig, once compiled with the -O ReleaseSmall command, it's only 5 KB (tested for windows 64)
Awesome. Added. On my system the smaller binary is 70K. (Followed this.) If I use -target x86_64-windows
it is 4.5K. That platform difference is very interesting, so I added a note about the host system at the top. Thanks!
One other interesting thing is if I use this Hello World the binary is 75K. I did use that example originally so I also updated the Zig entry for without the ReleaseSmall
flag which is now also slightly smaller.
kotlin-native 1.8.21: 916K
real 5.25
user 7.22
sys 0.29
Insists on using a .kexe
extension even if I do -o hello
.
Compiler written in java and hence the startup penalty. Expects you to use a build tool also written in the Java/Kotlin ecosystem.
Not interested in writing the compiler itself using Kotlin Native (asked in 2021).
Linked libs: libm libpthread libgcc_s
Cool. Thanks for the addition. What system did you build those results on?
Try a D hello world
[1] ldc2 -O -release -link-defaultlib-shared -betterC app.d // using extern(C)
[2] ldc2 -O -release -link-defaultlib-shared app.d // normal
import std.stdio : printf;
void main()
{
printf("Hello world");
}
vs betterC
import core.stdc.stdio;
extern(C) void main()
{
printf("Hello world");
}
I got it to 9-10k
Very interesting. The different D compilers have pretty different file size and linked lib results. Updated. Thanks for the comment!
Very interesting. The different D compilers have pretty different file size and linked lib results. Updated. Thanks for the comment!
You're welcome 😇
Rustlang ? 🙂