logoalt Hacker News

1vuio0pswjnm7 • yesterday at 7:08 PM • 1 reply • view on HN

Download: https://github.com/roc-lang/roc/releases/expanded_assets/0.1...

I tried Linux x86_64

No glibc, I'm using musl

https://github.com/roc-lang/roc/releases/download/0.1.0/roc-...

275.4M roc

roc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped

By comparison the size of the musl GCC toolchain I use is 242.3M

I've also used a static LLVM toolchain which is 328.8M

https://github.com/rsms/llvmbox/releases/expanded_assets/v15...

   cat > 1
   main!=|_args|{
   echo!("Hello, world!\n")
   Ok({})
   }
   ^D

roc build --no-cache 1.roc; strip -s 1

17.5K 1 (with --opt=size result was 18.0K)

1: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), static-pie linked, BuildID[sha1]=f44ebb81e1e06241ebccd8bb27a6e78dc07b9336, stripped

roc build --no-cache --opt=size --target=x64v1netbsd 1.roc; strip -s 1

1: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), static-pie linked, for NetBSD 8.0, BuildID[sha1]=f9032032100b247585d25c60741307495f94a094, stripped

8.1K 1

It seems that --no-cache does not work when using --target


Replies

rtfeldman • yesterday at 8:07 PM

> 275.4M roc

The `roc` binary size is almost all LLVM (and a bit of LLD on top of that). The actual Roc-specific logic is a very small fraction of the binary's contents. (You can see this by going to roc-lang.org and looking at the compiler we use in there for the in-browser repl; it doesn't bundle LLVM or LLD and it's otherwise the entire compiler, and last time I checked it weighed in at about 5mb of wasm uncompressed.)

We plan to replace both LLVM and LLD with smaller alternatives, but we don't want to sacrifice performance of optimized Roc code, so the transition won't be quick.