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

Here's Zig[1] for comparison:

    $ cat ../example/hello_world/hello.zig 
    const io = @import("std").io;
    
    pub fn main(args: [][]u8) -> %void {
        %%io.stdout.printf("Hello, world!\n");
    }
    $ ./zig build ../example/hello_world/hello.zig --export exe --name hello --release --strip
    $ wc -c hello
    5760 hello
    $ ldd ./hello
	not a dynamic executable
    $ ./hello 
    Hello, world!

5 KB. There are a few unfortunate reasons this isn't even smaller, one of them being a bug report[2] I filed in LLVM.

Also note that Rust is a lot further along than Zig right now. Zig does not have backtraces or threads yet. But I believe that the executable size for hello world in release mode will not contain backtrace code, or threads, or a memory allocator, even when Zig catches up to Rust in terms of std lib functionality.

[1]: http://ziglang.org/

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




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

Search: