Skip to content

perf(launch): compile string tables as UTF-8 and keep hidden menu work off the first frame - #4430

Merged
datlechin merged 3 commits into
mainfrom
perf/launch
Nov 23, 2026
Merged

datlechin merged 3 commits into
mainfrom
perf/launch

Conversation

@datlechin

@datlechin datlechin commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Summary

  • String tables compile as UTF-8 XML on macOS (STRINGS_FILE_OUTPUT_ENCODING[sdk=macosx*] = UTF-8). Linked against the macOS 27.0 SDK that CI builds with, CFBundle parses a binary table again, filtered to one key, for every key it has not seen yet. An XML table is parsed once and kept. iOS keeps binary. This reverses the format choice of Cut 5 MB from the bundle, and the layering that made it hard to find #2701: UTF-8 is 0.26 MB bigger on disk than binary over the 7 shipped languages (3.68 vs 3.42 MB), 46 KB smaller compressed with xz, against 1.9 MB for the UTF-16 default.
  • The two hidden Manual Commit footnotes in the Database menu are built with a plain title. Menu validation wraps the one it is about to show, so launch no longer runs two TextKit layouts for rows most sessions never see.
  • runRegistryUpdatePass takes its RegistryClient as an autoclosure and resolves it only after the empty-targets guard. A launch with no outdated plugin no longer opens the registry URL cache before the first window; PostLaunchWork builds the client after the frame, as before.

Measured (Time Profiler launches to the Welcome window, main-thread ms, median, interleaved, 6 bench connections, MacBook Pro M4):

en before en after fr before fr after
String lookups, whole launch (CI build, binary vs UTF-8 tables only, n=4) 36.5 11 72 23
Menu stage, willFinishLaunching to menuInstalled (same pair) 62 39.5 83 53.5
Plugin discovery stage (same pair) 17 12.5 23 12
Registry client and URL cache before the first frame (main 9d0d481 vs this branch, n=3) 2 0 1 0
phys_footprint 5 s after launch, MB (n=2) 43 43 to 44 43 to 44 45
  • The first three rows compare the CI-built Release app of main 9d0d481 (Xcode 27A9275, macOS 27.0 SDK) with the same app whose Localizable.strings were converted to UTF-8 XML, so they differ only in the table format. Load was 13 to 31 during that pair; the ratios held in every interleaved round.
  • A Release build of this branch on Xcode 27.2 (macOS 27.2 SDK) does not pay the binary cost: there, binary and UTF-8 tables measure the same in English (6 vs 8 ms) and binary is faster in French (14 vs 22 ms). The setting's comment says to measure again when CI moves to the 27.2 SDK.
  • The footnote layout (2 to 3 ms in the plan's traces) is under the 1 ms sampling noise of these runs; footnoteWrapsWhenShown pins that no footnote is laid out at build.

Tests changed on purpose:

  • CompiledStringsFormatTests.everyLanguageIsBinary becomes everyLanguageIsUTF8XML: every compiled Localizable.strings is a UTF-8 XML property list.
  • ManualCommitMenuTests.itemsFollowSafeModeLevel reads the footnote's plain title at build; new footnoteWrapsWhenShown checks the shown row is wrapped and the other is not.
  • PluginRegistryUpdatePassTests.noTargetsNoFetch also counts that the client is never resolved.

Deliberately not fixed here:

  • Restore selecting and saving once per connection (finding 8.2): gated on a restoreN profile the harness does not have yet, and it has to land after the close-path and session-save changes in other lanes.
  • Keyboard layout and menu hot key calls (13d): one WindowServer round trip each, no app-side fix.
  • NSApplication.shared cost under the probe's posix_spawn (13e): cause not found, no code change.

Test plan

  • verify.sh test on CompiledStringsFormatTests, ManualCommitMenuTests, PluginRegistryUpdatePassTests, SafeModeMenuDelegateTests, FrenchCountedStringsTests, MainMenuBuildPurityTests, MainMenuBuilderTests: 75 passed.
  • verify.sh lint on every changed Swift file: 0 violations.
  • Release build of this branch: every Localizable.strings starts with <?xml version="1.0" encoding="UTF-8"?>; all 16 bundled plugins load.

@datlechin
datlechin enabled auto-merge (squash) November 23, 2026 07:54
@datlechin
datlechin merged commit d16d511 into main Nov 23, 2026
13 checks passed
@datlechin
datlechin deleted the perf/launch branch November 27, 2026 16:38
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