Hacker News new | past | comments | ask | show | jobs | submit login

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/

[2]: https://bugs.llvm.org/show_bug.cgi?id=27610




And Nim can be a lot smaller too https://hookrace.net/blog/nim-binary-size/




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: