Skip to content

Feat: use zld for macOS x86 linker to reduce compile times for binaries #3470

Closed
@sambacha

Description

@sambacha

Dramatically reduce macOS x86 compile times for binaries

Describe the feature you would like

Utilize zld for linker. macOS has recently introduced dylb improvements, you can find out more here: https://developer.apple.com/videos/play/wwdc2022/110362/?time=729

Savings of at least ~23mins

The feature I would like I have already validated. Simply use zld in CI to achieve tis.

Current compilation time for x86 MacOS

Finished release [optimized] target(s) in 31m 32s

Improved compilation time for x86 MacOS

Finished release [optimized] target(s) in 8m 34s

gh clone foundry-rs/foundry && cd foundry
RUSTFLAGS="-Clink-arg=-fuse-ld=/Users/sbacha/zld/build/Build/Products/Release/zld" cargo build --release

How to utilize this for CI?

Naive first pass

wget https://github.com/michaeleisel/zld/releases/download/1.3.8/zld.zip
unzip zld.zip
RUSTFLAGS="-Clink-arg=-fuse-ld=$PWD/zld" cargo build --release

Built Artifact

Grab the compiled binary here: https://github.com/sambacha/foundry/releases/tag/rc-macos-x86-zld-lld

Additional Information

rust-lang/rust#39915
rust-lang/compiler-team#510
https://hackmd.io/YJQSj_nLSZWl2sbI84R1qA?view

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions