B&W print-friendly diagrams + tinkerpop-0001 + wave-3 proof sections. Squash of 94 local commits onto remote master.
1.3 KiB
1.3 KiB
| id | repo | severity | status | patched | patch | created |
|---|---|---|---|---|---|---|
| ts-0001 | TypeScript | HIGH | PATCHED | 2026-03-23 | defects/typescript/patch/ts-checker-set-visited.patch | 2026-03-23 |
Defect
File: src/compiler/checker.ts:11503
Pattern: resolutionTargets[] linear scan in findResolutionCycleStartIndex
Complexity: O(depth²)
Language: TypeScript
Description
findResolutionCycleStartIndex searches the resolutionTargets array to detect cycles in type resolution. The array is scanned linearly on each call to determine whether a given target is already being resolved. Because this function is called at each level of recursive type resolution, and the array grows with resolution depth, the total cost across all calls is O(depth²) in the resolution stack depth.
Fix
Replace: linear scan of resolutionTargets array
With: resolutionTargetSet.has(target)
Data structure change: resolutionTargets: array → resolutionTargets: array + resolutionTargetSet: Set
Work required
- Patch in
defects/typescript/patch/ - Unit test — asserts exact operation counts before/after (in
defects/typescript/unit/) - Integration test (in
defects/typescript/integration/) - Benchmark — before/after on V=100,200,400,800 (in
defects/typescript/bench/) - White paper section