Skip to content

fix: report Swift function and type check times from Xcode 26 logs - #259

Open
alielsokary wants to merge 4 commits into
MobileNativeFoundation:masterfrom
alielsokary:fix/swift-timing-xcode26
Open

alielsokary wants to merge 4 commits into
MobileNativeFoundation:masterfrom
alielsokary:fix/swift-timing-xcode26

Conversation

@alielsokary

Copy link
Copy Markdown

Depends on #256. The first two commits are #256, the last two are new.

With -Xfrontend -debug-time-function-bodies and -Xfrontend -debug-time-expression-type-checking set, logs from Xcode 26 and later still produced no function or type check times in any report. Two causes:

The flag is not on the section that holds the output

Xcode 26 and later put the swift-frontend flags on the SwiftDriver section. The SwiftCompile section carries the timing output but not the flag, and SwiftCompilerParser only looked at sections whose command names the flag. It now also accepts output that looks like timings.

The HTML report only read times from the step itself

From Xcode 14 on a SwiftCompile step is a batch and the times are parsed onto its per file substeps. HtmlReporter now reads those too, so the Swift functions and Swift type checks sections of the index page fill in.

Measured on a ResidentApp Debug build log, Xcode 27.0, on top of #256:

#256 this branch
function times in flatJson 0 64,551
type check times in flatJson 0 192,676
Swift functions on the index page 0 1,000
Swift type checks on the index page 0 1,000

AgapovOne and others added 4 commits August 25, 2026 11:17
Xcode renamed the Swift compilation tasks: `CompileSwift` became `SwiftCompile`
and `CompileSwiftSources` became `SwiftDriver`. `getDetailType` still matches
only the old spellings, so on a current log every Swift step is reported as
`.other`, and reporters that group by step type lose the compilation entirely.

The guard in `getSwiftIndividualSteps` is keyed to the same old name. Fixing the
classification alone would make it worse: a batch compilation names its files in
the command and the log already carries a subSection per file, so with the step
recognized as `.swiftCompilation` and the guard missing the modern name, every
file gets reported twice. Both places are updated together.

Measured on an Xcode 26.5 log of a ~400 module iOS app (5.9 min build), same log
before and after, release build from source:

  other                      314.4 min -> 9.0 min
  swiftCompilation               0 min -> 282.8 min
  swiftAggregatedCompilation      0 min -> 22.6 min
  detail steps                   24869 -> 24869

The step count and the sum of durations stay identical, so nothing is duplicated
or dropped; only the type of the existing steps changes.

`SwiftEmitModule`, `EmitSwiftModule` and `CodeSign` account for the 9 minutes
that remain unclassified. They have no matching case in `DetailStepType`, so
they are left for a separate change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Alex Agapov <agapov.one@gmail.com>
A single Xcode 26.5 log carries both: 86884 steps signed `CompileSwift` from
targets that compile whole module, next to 666 `SwiftCompile` and 457
`SwiftDriver` steps from the integrated driver. Calling the old spelling a
leftover of older Xcode versions was wrong, and the comments said so.

Behaviour is unchanged; this only rewrites comments and two test names.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Alex Agapov <agapov.one@gmail.com>
Xcode 26 and later put the swift-frontend flags on the SwiftDriver
section. The SwiftCompile section carries the -debug-time-function-bodies
and -debug-time-expression-type-checking output but not the flag, so the
parser skipped it and the reports never had function or type check times.

Signed-off-by: Ali Elsokary <ali.elsokary.w@gmail.com>
…TML report

From Xcode 14 on a SwiftCompile step compiles a batch of files and the
function and type check times are parsed onto its per file substeps. The
reporter only read the times of the step itself, so the Swift functions
and type checks sections of the index page stayed empty.

Signed-off-by: Ali Elsokary <ali.elsokary.w@gmail.com>
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.

2 participants