logoalt Hacker News

Panzerschrekyesterday at 5:30 AM3 repliesview on HN

I tried using it once by compiling it from sources. Even a release build is several hundred megabytes in size, which I find pretty wasteful. After a little investigation I found, that it has many plugins in form of a shared library, and each of them has pretty huge size, presumably because the whole Rust standard library is statically linked.


Replies

hrmtst93837yesterday at 10:05 PM

Those huge plugin files result from Rust duplicating libstd into each plugin at link time when crates are built as cdylib or staticlib, and you can prove it with cargo-bloat or by inspecting DT_NEEDED and symbol sizes with readelf -d and ldd.

If you control the build, force shared std linking with RUSTFLAGS='-C prefer-dynamic' and crate-type = ['dylib'] so host and plugins share libstd and accept the need for matching toolchains, or switch to a different plugin model like compiling to WASM and running modules with wasmtime or exposing a small C-ABI shim into a single shared runtime, and use strip plus LTO for quick size wins.

whytevuhuniyesterday at 6:45 AM

Interesting, although I checked and on NixOS the binary is just 29MB. It was statically linked, with just libc left as dynamic.

I think 29MB is still huge for a terminal text editor, but nevertheless not "hundreds".

show 1 reply
small_scombrusyesterday at 7:12 AM

My local build of helix is 20MB, did you use the suggested flags on the install guide page?