feat: stream and accelerate large build logs - #79
Merged
alexey1312 merged 2 commits intoAug 18, 2026
Conversation
SunsetWan
marked this pull request as ready for review
August 6, 2026 16:17
Collaborator
|
Thanks for this, really solid work 🚀. |
This was referenced Aug 18, 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.
What
StreamingOutputParserwhile preservingOutputParseras the complete-input compatibility APIreadToEnd()with a POSIX-backed 64 KiB streaming reader and bounded 5,000-byte line framingmemchrframing and decode complete in-chunk lines directly while preserving split UTF-8, CRLF, EOF, empty-line, and oversized-line behaviorsplit/joinWhy
The CLI previously waited for EOF, retained the whole build log as
Data/String, then created a second full collection of line strings before parsing. The first streaming implementation bounded memory, but profiling a 500 MiB phase-heavy stress log still took 226.97 seconds because every line ran many independent Foundation string searches and parsers whose output was not requested.The final implementation parses while stdin arrives, scans each line once for relevant categories, and avoids unnecessary work without changing output semantics.
Performance
Reference run on arm64 macOS 26.6 with Swift 6.3.3. Primary figures are medians of three release runs:
The 500 MiB phase-heavy stress case is about 261 times faster. The VideoGo-shaped profile uses the measured log mix (about 0.13% phase lines and 9.43% warning lines), so it is more representative than the intentionally pathological all-phase fixture.
Additional 500 MiB checks completed in 0.72 s (
fast-reject), 0.94 s (fast-reject-unicode), 0.63 s (fixture-mixed), and 3.41 s (warning-duplicate). Exact distinct-warning state still scales with the number of unique diagnostics;warning-uniqueused 265.92 MiB RSS at 100 MiB.TDD and correctness
Verification
swift format lint --strict --recursive .swift test- 423 tests, 0 failuresswift build -c releasebash -n Benchmarks/large-log.shBenchmarks/large-log.sh 10 100 500for phase-heavy and VideoGo-shaped inputs, three runs eachScope
The referenced analysis also recommends VideoGo gate/process changes. Those belong to the consuming project rather than this repository and are intentionally not part of this PR.