From 135f14ee407b0464370f4d745d64db983c2f12cc Mon Sep 17 00:00:00 2001 From: pjh456 <147148383@qq.com> Date: Sat, 10 Oct 2026 15:33:05 +0000 Subject: [PATCH] =?UTF-8?q?build:=20=E7=A7=BB=E9=99=A4=E6=97=A0=E6=95=88?= =?UTF-8?q?=E7=9A=84=20release=20=E6=8C=87=E4=BB=A4=E9=9B=86=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .cargo/config.toml | 10 +++++++--- .github/actions/setup-tools/action.yml | 7 +++---- Cargo.toml | 3 --- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index a4455e10..3e0fa98c 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -5,7 +5,11 @@ rustflags = ["-D", "warnings"] rustc-wrapper = "sccache" [target.x86_64-unknown-linux-gnu] -# mold 链接器:并行链接,比 GNU ld 快 5 至 10 倍(98M 二进制链接 4.4s 降到 -# 亚秒级)。走 cc 驱动的 -fuse-ld=mold(不能直接 linker="mold":rustc 会把 -# cc 驱动参数 -m64/-Wl, 原样传给 mold,mold 不认)。对 dev 与 release 全 profile 生效。 +# mold 链接器:并行链接,比 GNU ld 快 5 至 10 倍。走 cc 驱动的 -fuse-ld=mold +# (不能直接 linker="mold":rustc 会把 cc 驱动参数 -m64/-Wl, 原样传给 mold, +# mold 不认)。对 dev 与 release 全 profile 生效。CI 由 setup-tools 从工作副本 +# 剥掉此行(sccache 包装 rustc 时链接子进程定位不到 mold)。 +# +# 不设 target-cpu 指令集档位:native 与 x86-64-v3 经同机交替 A/B 实测对本解释器 +# 无收益(差异在 ±2% 噪声内),解释器为分支/指针密集,吃不到 SIMD 红利。 rustflags = ["-C", "link-arg=-fuse-ld=mold"] diff --git a/.github/actions/setup-tools/action.yml b/.github/actions/setup-tools/action.yml index 79868a89..6901d114 100644 --- a/.github/actions/setup-tools/action.yml +++ b/.github/actions/setup-tools/action.yml @@ -33,10 +33,9 @@ runs: - name: Configure build cache shell: bash run: | - # CI 链接器统一走默认 lld:sccache 包装 rustc 时,链接子进程定位不到 mold、 - # 回退默认 ld 报 cannot find ld。只删工作副本的 mold 行,本地提交的 config - # 保留 mold 提速。 - sed -i '/link-arg=-fuse-ld=mold/d' .cargo/config.toml + # CI 链接器走默认 ld:sccache 包装 rustc 时链接子进程定位不到 mold,回退默认 + # ld 报 cannot find ld。只改工作副本,本地提交的 config 保留 mold 提速。 + sed -i '/^rustflags = .*fuse-ld=mold/d' .cargo/config.toml - name: Verify tools in PATH shell: bash diff --git a/Cargo.toml b/Cargo.toml index f023b1de..716c418e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,9 +78,6 @@ lto = false codegen-units = 256 debug = 0 panic = "abort" -# 本机 CPU 指令集(AVX2 等):解释器热路径墙时间再挤 5 至 15%。产物绑定本机 -# 微架构,不可跨机移植(本机开发机与 CI 各自源码构建,无影响)。 -target-cpu = "native" [profile.dev] # 行表级调试信息:产物体积降 5 至 10 倍(单个 oxide CLI 约 160M 降到 30M 量级),