4 ms·
I have been using mold every day for almost a year, and it has dramatically improved my quality of life by decreasing link times on the Rust project I work on f
by nitsky 5y ago
I have been using mold every day for almost a year, and it has dramatically improved my quality of life by decreasing link times on the Rust project I work on from approximately 10 seconds to less than one second. This makes a big difference in keeping focus during the edit-compile-run loop. Thank you!
- c0balt 5y agoMaybe a dumb question but how would I go about using it with rust(c) and cargo? Would love to try it out, if it decreases total compile times.
- the_duke 5y agoRUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=/path/to/mold" cargo build or persitant in your project: .cargo/config.toml [target.x86_64-unknown-linux-gnu] linker = "clang" rustflags = ["-C", "link-arg=-fuse-ld=/PATH/TO/mold"]
- c0balt 5y agoThank you. Will try it later
- fbernier 5y ago-fuse-ld has been replaced by --ld-path in clang 12+
- the_duke 5y agoGood to know, thanks. fuse-ld still works though.
- wyldfire 5y agoI wonder -- "-fuse-ld" has some somewhat surprising behavior in how clang ends up discovering the linker. I think that even if clang has a sibling `lld` in the same distribution, "-fuse-ld=lld" will pick "ld.lld" from the $PATH if it's present in there before the directory where clang and lld are installed. So maybe that "--ld-path" option helps resolve ambiguity by expecting an explicit path instead of a linker name.
- 4khilles 5y ago"mold -run cargo build" would also work.
- the_duke 5y agoWarning: don't do this if you use rust-analyzer or any other IDE that uses cargo check. The flags are part of the cache hash, so your IDE and cli constantly invalidate the cache and compile from scratch.
- tomcam 5y ago> decreasing link times on the Rust project I work on from approximately 10 seconds to less than one second. But enough about writing “hello, world“ programs in Rust. I kid.