Skip to content

[BENCH, do not merge] Measure -fomit-frame-pointer and --icf=all on the macOS bindings - #6731

Draft
Fedr wants to merge 4 commits into
masterfrom
bench-macos-size
Draft

[BENCH, do not merge] Measure -fomit-frame-pointer and --icf=all on the macOS bindings#6731
Fedr wants to merge 4 commits into
masterfrom
bench-macos-size

Conversation

@Fedr

@Fedr Fedr commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Benchmark only, not for merge. Measures the two size levers that are left for the bindings after -Oz and ThinLTO, on the macOS legs.

Why these two, and not the usual suspects: I scanned the published mrmeshpy.so of 3.1.3.429 and -Oz already leaves 477 bytes of alignment padding in a 34.7 MB __text, so -falign-functions and friends have nothing to recover. What the scan did find is 202,218 push rbp; mov rbp,rsp prologues in the macOS x86_64 build against 3 in the Linux one — Apple's Clang keeps frame pointers on x86-64, Linux Clang omits them at -O2+ — worth roughly 1.2 MB with the epilogues, plus whatever freeing rbp saves in spills.

--icf=all is restricted to Linux with the note "until lld-link (Windows) and ld64.lld (macOS) get their own measurements", where it removed 11% of the module. This is that measurement for macOS.

The step prints file size and __text for four variants:

variant how
baseline the module the job just built
--icf=all re-link of the same objects, link-only flag
-fomit-frame-pointer fragments recompiled, then linked
both re-link of those fragments with ICF

Only one recompile round is needed, so this adds roughly 15-25 min per macOS leg. Every non-macOS platform is disabled by label. I will close this PR and delete the branch once the numbers are in.

Note that neither flag touches the actual x86-64 vs arm64 gap (__text 34.7 MB vs 21.4 MB on macOS, 34.4 vs 21.9 on Linux) — that is instruction encoding and register count, and no flag fixes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant