Skip to content

Commit 14fe7a0

Browse files
committed
YJIT: Use ThinLTO for Rust parts in release mode
This reduces the code size of libyjit.a by a lot. On darwin it went from 23 MiB to 12 MiB for me. I chose ThinLTO over fat LTO for the relatively fast build time; in case we need to debug release-build-only problems it won't be painful.
1 parent b572595 commit 14fe7a0

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

common.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ YJIT_RUSTC_ARGS = --crate-name=yjit \
225225
--crate-type=staticlib \
226226
--edition=2021 \
227227
-g \
228+
-C lto=thin \
228229
-C opt-level=3 \
229230
-C overflow-checks=on \
230231
'--out-dir=$(CARGO_TARGET_DIR)/release/' \

yjit/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,5 @@ opt-level = 3
4545
overflow-checks = true
4646
# Generate debug info
4747
debug = true
48+
# Use ThinLTO. Much smaller output for a small amount of build time increase.
49+
lto = "thin"

0 commit comments

Comments
 (0)