From e62febf0f404facf6e020c3d6cf5989518e18c9d Mon Sep 17 00:00:00 2001 From: Soispha Date: Mon, 24 Jul 2023 16:44:38 +0200 Subject: [PATCH] Build(Cargo): Add mold as default linker in both profiles I measured the linking times by running `cargo rustc --bin trinitrix -- -Z time-passes`, which resulted in following data: `ld`: 37.794s to link `mold`: 21.389s to link The downside for now is, that this requires to have mold installed to build trinitrix (The nix flake based direnv already has it) and that mold only works on linux. --- .cargo/config.toml | 2 ++ flake.nix | 1 + 2 files changed, 3 insertions(+) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..7af97f1 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[target.x86_64-unknown-linux-gnu] +rustflags = ["-C", "link-arg=-fuse-ld=mold"] diff --git a/flake.nix b/flake.nix index 72bee03..aaa4f92 100644 --- a/flake.nix +++ b/flake.nix @@ -52,6 +52,7 @@ nativeBuildInputs = with pkgs; [ pkg-config + mold ]; buildInputs = with pkgs; [ openssl