Skip to content

perf(macos): ship smaller binaries: no exports, one lease chain, no duplicate helpers or unused clients - #4233

Merged
datlechin merged 4 commits into
mainfrom
fix/perf-size
Nov 12, 2026
Merged

datlechin merged 4 commits into
mainfrom
fix/perf-size

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • Performance audit 2026-11-11, binary size: LC-04 and SZ-02 to SZ-10. SZ-01 stays out: releases stay universal.
  • SZ-02: the Release app, tablepro-mcp, tablepro-cli and every plugin bundle link with an empty exported symbols list (apple/Configs/NoExportedSymbols.exp). Nothing binds to their symbols: plugins are two-level, have no bundle loader, and load through principalClass. Debug app builds keep their exports for the test bundle.
  • SZ-03: withScopedDriver, withCancellableRead and withTableReadDriver wrap the body once and run one boxed, non-generic lease chain, instead of a copy of the chain per result type.
  • SZ-05: DescriptorRead and DescriptorWrite move from TableProUtilities to TableProProcess. TableProMCP and TableProCommandLine drop TableProUtilities, so both tools stop linking the SQL grammar, tabular IO and JavaScriptCore.
  • SZ-06: the editor depends on the DequeModule and _RopeModule products instead of the Collections umbrella.
  • SZ-07: the Cloud API generator config filters to the 7 operations the app calls.
  • SZ-08: Firebase, Qdrant and Weaviate cores keep only the statement parsing the query classifier uses. Their network side moves to new TableProFirebaseClient, TableProQdrantClient and TableProWeaviateClient targets that only the registry plugins link.
  • SZ-10: cockroachdb, snowflake and starrocks SVGs declare 24 x 24, so actool stops rasterizing fallbacks at 2486 and 800 points.
  • .claude/rules/plugin-system.md: the R1 check runs on a Debug build or a Release dSYM, since Release plugins no longer keep symbols.
arm64 Release archive, unsigned, on 375463a before after
TablePro 72,177,304 67,531,640
tablepro-cli 3,541,472 2,079,568
tablepro-mcp 2,595,280 1,161,744
16 bundled plugins 12,521,616 12,035,696
Assets.car 2,120,968 1,762,776
App bundle 115,182,051 106,796,835
  • SZ-02: export tries 1,156,376 -> 8 B (app), 208,000 and 171,912 -> 8 (tools), 286 KB -> 8 B each across the plugins; ld also drops 66 KB of libmariadb and 54 KB of libpq. Swift 6.4 marks every public symbol no_dead_strip, so no Swift code goes away with the exports.
  • SZ-02, registry DuckDB plugin (arm64 Release): 53,362,048 -> 46,373,840 B; 33,242 exports and a 2 MB trie gone, 1.46 MB of DuckDB code dead-stripped. DuckDB's runtime extensions bind nothing from it: httpfs and quack v2.0.0 (and every cached v1.5.4 extension) are MH_NOUNDEFS with no DuckDB import.
  • SZ-03: lease chain symbols 1,935,340 -> 254,236 B.
  • SZ-05: tablepro-mcp -55%, tablepro-cli -41%.
  • SZ-06: HashTreeCollections, OrderedCollections, BitCollections and HeapModule leave the app: 582,786 B.
  • SZ-07: TableProCloudAPI 1,078,529 -> 462,455 B.
  • SZ-08: in the app, TableProFirebaseCore 279,153 -> 71,422, TableProQdrantCore 202,084 -> 37,985, TableProWeaviateCore 160,604 -> 51,869 B.
  • SZ-10: the three icons 368,340 -> 6,260 B in Assets.car.
  • Sandboxed launch, 10 interleaved runs: exec to main median 59.4 -> 54.1 ms; first frame 525 vs 527 ms.

Not changed:

  • LC-04: a probe linking the app's dylib set reaches main with 1,168 images in 15.7 ms (median of 60) and 12.6 ms without AuthenticationServices and Charts (708 images). First frame spreads over 483 to 707 ms across launches, so 3 ms is under the noise.
  • SZ-09: posthog-ios 3.92.7 (and 3.94.4) ships one product, and PLCrashReporter is a hard dependency of it. Replacing the SDK means reimplementing its queue and identity handling.
  • SZ-04, partly: the tools' copies of TableProSQLGrammar, TableProTabularIO and TableProUtilities are gone (duplicates 8.0 -> 5.5 MB). See "Needs the maintainer".
  • InfluxDB: the classifier's closure is nearly the whole core, so it stays as it is.

Needs the maintainer

  • SZ-04 remainder, 5.5 MB per arch: TableProMCP in both tools (1.8 MB), TableProSQLGrammar in the MySQL, SQLite and ClickHouse plugins (1.6 MB), TableProTabularIO in CSVImport and XLSXImport (0.9 MB). One shared dynamic framework would remove them, but it has to hold every shared module and every static product that depends on one, or a module lands in two images and casts across them fail the way R1 describes. That is a structure decision; this PR keeps static linking.
  • Swift 6.4 marks public symbols no_dead_strip; only the hidden -Xfrontend -internalize-at-link lets ld drop unused public Swift code. Not used here.

Test plan

  • Release arm64 archive before and after (LD_GENERATE_MAP_FILE=YES): sizes from otool -l, per-module bytes from the link maps, icons from assetutil --info.
  • scripts/ci/verify-plugin-loads.sh on the 16 bundled Release plugins and the 48 Debug plugins; R1 and R2 clean.
  • Sandboxed Release launch opens a SQLite file: the plugin activates and the schema loads.
  • Unit plan, 428 cases: ScopedDriver*, SessionLanes, SessionTransactionTracker, DatabaseSwitchLeaseOrdering, MetadataConnectionPool*, CatalogTableListing, DatabaseTreeMetadataService*, QueryClassifier*, ExternalStatementGate, PipeReader, ProcessNativeDumpRunner, MCPIdentityLedger, BridgeStdout, MCPStderrBridgeLogger, CLI*.
  • swift test TableProCore: TableProProcessTests, TableProFirebaseCoreTests, TableProQdrantCoreTests, TableProWeaviateClientTests, 108 cases.
  • AllPlugins build.

@datlechin
datlechin enabled auto-merge (squash) November 12, 2026 08:29
@datlechin
datlechin merged commit 07ef29f into main Nov 12, 2026
14 checks passed
@datlechin
datlechin deleted the fix/perf-size branch November 12, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant