3 ms·
Zig[1] hello world is a 13 KB static executable: const io = @import("std").io; pub fn main() -> %void { %%io.stdout.printf("Hello, world!\
by AndyKelley 10y ago
Zig[1] hello world is a 13 KB static executable:
const io = @import("std").io;
pub fn main() -> %void {
%%io.stdout.printf("Hello, world!\n");
}
It could be a lot smaller, but I'll have to fix an LLVM bug[2] or two.
For comparison (these are all with full optimization and stripped):
* Go: 1,006 KB, static executable
* Rust: 411 KB, links to libdl.so, libpthread.so, libgcc.so, libc.so
* C: 6 KB, links to libc.so
* C++: 6 KB, links to libstdc++.so, libc.so
* Nim: 26 KB, links to libdl.so, libc.so
* D: 546 KB, links to libpthread.so, libm.so, librt.so, libdl.so, libgcc.so, libc.so
libc.so is 1.9MB. libstdc++.so is 1.5MB.
[1]: http://ziglang.org/ http://ziglang.org/
[2]: https://bugs.llvm.org/show_bug.cgi?id=27610 https://bugs.llvm.org/show_bug.cgi?id=27610
- dom96 10y agoAnd Nim can be a lot smaller too https://hookrace.net/blog/nim-binary-size/ https://hookrace.net/blog/nim-binary-size/