fix(size): Keep demangle parallelism inside binary analysis workers - #671
Merged
Conversation
The worker initializer disabled cwl-demangle's thread fan-out so the four-worker pool could not multiply into sixteen demangle subprocesses. That cap turned the heaviest binary into a single-threaded critical path: a main binary with 1.6M Swift symbols that demangled in about 333s under the serial analyzer now runs its 3200 chunks one at a time and blows through the 900s task deadline. Drop the override so each worker keeps the same four demangle threads the serial path had. Oversubscription only occurs while several heavy binaries overlap, and each subprocess handles a 500-symbol chunk and exits, so memory stays bounded.
Contributor
Size Analysis2 components analyzed iOS Builds
Android Builds
|
Contributor
📲 Install BuildsiOS
Android
|
trevor-e
approved these changes
Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #663. After the parallel binary analysis rolled out to EU, a re-upload of a customer iOS build hit the 900s task deadline. The 4-worker pool phase itself finished cleanly (18 binaries started, 17 completed within four seconds), but the main app binary, which has 1.6M Swift symbols, never completed: its demangle ran for 14 minutes until taskbroker killed the task. The same binary demangled in about 333s under the old serial analyzer, where the whole build took 387s.
The cause is the worker initializer setting
LAUNCHPAD_NO_PARALLEL_DEMANGLE=true. That was added during review to bound subprocess count, so four workers could not each fan out to fourcwl-demanglethreads. But it turned the heaviest binary, which is the critical path, from four demangle threads into one, and 3200 sequential chunks do not fit under the deadline. Parallelism across binaries does not help when one binary dominates.This drops the override so each worker keeps the same four demangle threads the serial path had. Worst case is sixteen concurrent
cwl-demanglesubprocesses on a 4-CPU pod while several heavy binaries overlap. Throughput is CPU-bound either way, so the phase does not get slower, and each subprocess handles a 500-symbol chunk and exits, so memory stays bounded. The remaining thing to watch is the 10s per-chunk timeout under contention, since timed-out chunks are silently dropped rather than failing the build; if those show up on large apps the fix is a longer chunk timeout, not restoring the cap.Existing worker and parallel-vs-in-process integration tests pass; there was no test asserting the env var. To verify after deploy: re-upload the customer build and check its trace for completion and for any demangle timeout errors.