diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..bd04b358 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,12 @@ +# ── Build-time CPU optimisation ──────────────────────────────────────── +# Compile for the host CPU so BLAKE3 SIMD (AVX2 / AVX-512 / NEON), +# image processing and crypto routines use the fastest available +# instructions. Works on x86-64 (Intel/AMD) and ARM (Apple Silicon, +# Raspberry Pi) — the compiler auto-detects the local CPU features. +# +# NOTE: the resulting binary is NOT portable to CPUs with fewer +# features than the build host. For portable Docker images, override +# with: RUSTFLAGS="-C target-cpu=x86-64-v3" (AVX2, most servers). + +[target.'cfg(any(target_arch = "x86_64", target_arch = "aarch64"))'] +rustflags = ["-C", "target-cpu=native"] diff --git a/.gitignore b/.gitignore index 1b29f8c5..2fe1ed61 100755 --- a/.gitignore +++ b/.gitignore @@ -17,8 +17,9 @@ *.su *.idb -# Build cache -.cargo/ +# Build cache (keep .cargo/config.toml for project build settings) +.cargo/* +!.cargo/config.toml # Visual Studio Code directory .vscode/