nandi/jolt-nativepublic Fork 0
aabacba
Commits
Clone
git clone https://git.rickub.com/nandi/jolt-native.git
git clone ssh://git@rickub.com/nandi/jolt-native.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Ship the object without the notes nobody reads

Debug info was 5.9M of the 14.5M the phone carries, and no one is on the
far end of it: the .so goes into the APK, and a crash comes back through
logcat as a bionic backtrace over the loaded segments, never a DWARF line
table. cargo's release profile already carried none — its object strips to
within 168 bytes of itself — so buck2 was the odd one out rather than the
generous one.

Fat LTO on the cdylib is the other half. It takes .text down a tenth and
halves the unwind tables, which are mostly duplicate landing pads once the
graph is one unit. opt-level stays at 2: 3 was measured beside it and came
out 134K larger.

Android libvidya, 14,496,256 to 8,804,920. The desktop pair comes along
through the shared profile — libvidya 12.6M to 10.8M, libjoltmoq 22.2M to
19.0M.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nandi committed 2026-08-31T19:13:57-07:00 Browse files
aabacba parent: c71fc59
modified Cargo.toml +5 -0
@@ -41,6 +41,11 @@ repository = "https://gitlab.com/nandithebull/jolt-native"
4141 # worth looking at. A member cannot set this, so it is set here.
4242 [profile.release]
4343 opt-level = 2
44+# The same pair the buck2 cdylib sets in crates/jolt-vidya/BUCK, so the two
45+# builds of libvidya agree on more than opt-level. 1.5M off the desktop object;
46+# opt-level 3 was measured alongside and is larger, so it stays at 2.
47+lto = "fat"
48+codegen-units = 1
4449
4550 [workspace.dependencies]
4651 jolt-abi = { path = "crates/jolt-abi" }
@@ -41,6 +41,11 @@ repository = "https://gitlab.com/nandithebull/jolt-native"
41 # worth looking at. A member cannot set this, so it is set here.41 # worth looking at. A member cannot set this, so it is set here.
42 [profile.release]42 [profile.release]
43 opt-level = 243 opt-level = 2
44+# The same pair the buck2 cdylib sets in crates/jolt-vidya/BUCK, so the two
45+# builds of libvidya agree on more than opt-level. 1.5M off the desktop object;
46+# opt-level 3 was measured alongside and is larger, so it stays at 2.
47+lto = "fat"
48+codegen-units = 1
44 49
45 [workspace.dependencies]50 [workspace.dependencies]
46 jolt-abi = { path = "crates/jolt-abi" }51 jolt-abi = { path = "crates/jolt-abi" }
modified crates/jolt-vidya/BUCK +12 -0
@@ -10,6 +10,18 @@ rust_library(
1010 # and that name, not the filename, is what the linker writes into a
1111 # dependent's DT_NEEDED. Every consumer looks for `libvidya`.
1212 soname = "libvidya.so",
13+ # Cross-crate inlining across the whole graph, and one codegen unit so the
14+ # dedup is not fighting parallelism inside the crate. Measured on the
15+ # desktop object: 12.06M to 10.57M, of which 628K is .text and the rest is
16+ # the unwind tables halving — LTO alone folds most of the duplicate landing
17+ # pads away. Only the cdylib asks for it; the rlibs above stay as they are.
18+ #
19+ # opt-level stays at 2. 3 was measured too and came out 134K *larger*, so
20+ # the level in the toolchain is the one to keep.
21+ rustc_flags = [
22+ "-Clto=fat",
23+ "-Ccodegen-units=1",
24+ ],
1325 visibility = ["PUBLIC"],
1426 # Cargo renames the dependency so the cdylib itself can keep the `vidya`
1527 # crate name; mirror that here.
@@ -10,6 +10,18 @@ rust_library(
10 # and that name, not the filename, is what the linker writes into a10 # and that name, not the filename, is what the linker writes into a
11 # dependent's DT_NEEDED. Every consumer looks for `libvidya`.11 # dependent's DT_NEEDED. Every consumer looks for `libvidya`.
12 soname = "libvidya.so",12 soname = "libvidya.so",
13+ # Cross-crate inlining across the whole graph, and one codegen unit so the
14+ # dedup is not fighting parallelism inside the crate. Measured on the
15+ # desktop object: 12.06M to 10.57M, of which 628K is .text and the rest is
16+ # the unwind tables halving — LTO alone folds most of the duplicate landing
17+ # pads away. Only the cdylib asks for it; the rlibs above stay as they are.
18+ #
19+ # opt-level stays at 2. 3 was measured too and came out 134K *larger*, so
20+ # the level in the toolchain is the one to keep.
21+ rustc_flags = [
22+ "-Clto=fat",
23+ "-Ccodegen-units=1",
24+ ],
13 visibility = ["PUBLIC"],25 visibility = ["PUBLIC"],
14 # Cargo renames the dependency so the cdylib itself can keep the `vidya`26 # Cargo renames the dependency so the cdylib itself can keep the `vidya`
15 # crate name; mirror that here.27 # crate name; mirror that here.
modified toolchains/BUCK +7 -0
@@ -127,6 +127,13 @@ hermetic_rust_toolchain(
127127 # without this the two objects are debug builds wearing release names.
128128 # OPT_LEVEL=2 in the buildscript fixups is the same setting for the C.
129129 "-Copt-level=2",
130+ # Debug info is 5.9M of the 14.5M Android object, and nothing reads it:
131+ # the .so ships in the APK, and a crash comes back through logcat as a
132+ # bionic backtrace against the loaded segments, not a DWARF line table.
133+ # cargo's release profile already carries none — its object strips to
134+ # within 168 bytes of itself — so this is buck2 matching that, not a
135+ # new decision about what is debuggable. Drop the flag to get it back.
136+ "-Cstrip=debuginfo",
130137 "--cfg=jolt_cc=\"" + _ZIG_VERSION + "\"",
131138 ],
132139 # Only triples there is an archive for can be named here: the desktop one
@@ -127,6 +127,13 @@ hermetic_rust_toolchain(
127 # without this the two objects are debug builds wearing release names.127 # without this the two objects are debug builds wearing release names.
128 # OPT_LEVEL=2 in the buildscript fixups is the same setting for the C.128 # OPT_LEVEL=2 in the buildscript fixups is the same setting for the C.
129 "-Copt-level=2",129 "-Copt-level=2",
130+ # Debug info is 5.9M of the 14.5M Android object, and nothing reads it:
131+ # the .so ships in the APK, and a crash comes back through logcat as a
132+ # bionic backtrace against the loaded segments, not a DWARF line table.
133+ # cargo's release profile already carries none — its object strips to
134+ # within 168 bytes of itself — so this is buck2 matching that, not a
135+ # new decision about what is debuggable. Drop the flag to get it back.
136+ "-Cstrip=debuginfo",
130 "--cfg=jolt_cc=\"" + _ZIG_VERSION + "\"",137 "--cfg=jolt_cc=\"" + _ZIG_VERSION + "\"",
131 ],138 ],
132 # Only triples there is an archive for can be named here: the desktop one139 # Only triples there is an archive for can be named here: the desktop one