Uh oh!
There was an error while loading. Please reload this page.
Perform bounds-checking on string input in scanner - #58362
Perform bounds-checking on string input in scanner#58362Ron Buckton (rbuckton) wants to merge 2 commits into
Conversation
Ron Buckton (rbuckton)
commented
Apr 29, 2024
TypeScript Bot (@typescript-bot) perf test |
TypeScript Bot (typescript-bot)
commented
Apr 29, 2024
Ron Buckton (@rbuckton), the perf run you requested failed. You can check the log here. |
1 similar comment
TypeScript Bot (typescript-bot)
commented
Apr 29, 2024
Ron Buckton (@rbuckton), the perf run you requested failed. You can check the log here. |
Jake Bailey (jakebailey)
commented
Apr 29, 2024
TypeScript Bot (@typescript-bot) perf test |
TypeScript Bot (typescript-bot)
commented
Apr 29, 2024
Jake Bailey (@jakebailey) Here they are:tscComparison Report - baseline..pr
System info unknown Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown Hosts
Scenarios
startupComparison Report - baseline..pr
System info unknown Hosts
Scenarios
Developer Information: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TypeScript Bot (typescript-bot)
commented
Apr 29, 2024
Ron Buckton (@rbuckton) Here they are:tscComparison Report - baseline..pr
System info unknown Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown Hosts
Scenarios
startupComparison Report - baseline..pr
System info unknown Hosts
Scenarios
Developer Information: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Ron Buckton (rbuckton)
commented
Apr 29, 2024
Looks like there was no noticeable performance improvement with this change, so we should only take it if we think the bounds checking enforcement is worth adding purely for the sake of correctness and stability. |
It seems like parse is (only very slightly) worse - I wonder what happens if you switch that initial call in |
Ron Buckton (rbuckton)
commented
Apr 29, 2024
It may be that some code paths aren't run enough times to be optimized and thus the functions aren't inlined. I'll have to look at it in deopt-explorer. |
TypeScript Bot (typescript-bot)
commented
Dec 15, 2025
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
Following on to #58339, this performs the same bounds checking throughout most of the rest of the scanner.
This also adds the
local/bounds-checklint rule to warn if future changes incorrectly perform unchecked calls tocharCodeAtorcodePointAtontext. The lint rule performs some rudimentary analysis to determine whether a call tocodePointUncheckedorcharCodeUncheckedfollows a valid boundary check to cut down on excess// eslint-disable-linecomments for cases like these: