Repository navigation
Find the end of multi-line comments with a substring search after the first line break - #64990
Mateusz Burzyński (Andarist) wants to merge 1 commit into
Conversation
… first line break
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the multiline comment scanning optimization.
No open issues 🎉
What changed in this PR
This PR optimizes multi-line comment scanning in the native TypeScript compiler, targeting faster parsing of JSDoc-heavy files.
Changes:
- Uses a substring search to locate the closing delimiter after the first line break.
- Scans backward to identify the last line for comment-directive processing.
- Adds tests covering line-break variants, Unicode text, directive placement, and unterminated comments.
| File | Description |
|---|---|
tsc/internal/scanner/scanner.go |
Adds the optimized multi-line comment tail scanner. |
tsc/internal/scanner/scanner_test.go |
Tests comment boundaries, token flags, and directive ranges. |
Review effort: Balanced
|
TypeScript Bot (@typescript-bot) perf test this faster |
|
Jake Bailey (@jakebailey) Here they are:
Provisional hosted-runner results: these VMs are not the dedicated benchmark machines. Results may be noisier and are not comparable to the historical series. For comparisons, both revisions of each scenario ran on the same VM. tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This gives pretty nice improvements in the JSDoc-heavy sources. On my machine
dom.generated.d.tsends up being parsed up to 7% faster