From b4d9bea75ae3e33faf0247f081c84c8417b27d90 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 9ce72bf..4a0858f 100644 --- a/flake.nix +++ b/flake.nix @@ -55,6 +55,7 @@ nativeBuildInputs = with pkgs; [ pkg-config + mold ]; buildInputs = with pkgs; [ openssl