Context
The accepted control_flow workload on the TypeScript comparison tracker uses one unchanged 9,485-line module with 256 discriminated-union switches, narrowed property reads, definite assignments, exhaustiveness checks, and typed return objects. All three compilers accept it silently.
Five-run red baseline (milliseconds):
| Compiler | Mean | Stddev |
|---|---|---|
| tsc 6.0.3 | 281.9 | 52.8 |
| TypeScript 7.0.2 native | 81.5 | 21.8 |
| Home | 2927.8 | 159.6 |
Profile
An Xcode Time Profiler capture over the unchanged workload attributes most execution time to repeated whole-source compatibility fallbacks reached from typed identifier lookup:
- ~48% inclusive in
typeAnnotationContainsUnresolvedRef, with repeated UMD namespace discovery/source scans - ~40% inclusive in
recoveredSourceParameterAnnotationType/sourceParameterDeclarationContainsUse, even when a lexical HIR annotation was already found - ~10% in used-before-assignment scans, to reassess after removing the dominant redundant work
The checker already computes source_may_have_umd_namespace_export in setSource, but sourceHasUmdNamespaceExport does not consult it. Parameter syntax recovery is likewise intended as a parser-recovery fallback and should not rescan when the lexical annotation is present.
Acceptance criteria
- Keep the committed benchmark source, size, and compiler configurations unchanged.
- Skip parameter recovery only when the normal lexical annotation is available.
- Use the conservative UMD prefilter without changing UMD behavior.
- Run focused compatibility tests and the complete TypeScript checker suite.
- Re-profile and address any remaining general bottleneck required for Home to beat TypeScript 7.0.2 on this workload.
- Publish the corrected 30-run result in the performance docs and README summary.
Refs #416