Repository navigation
Run counted loops from an unproven start as integer loops - #845
Merged
Merged
Conversation
`for (let i = start; i < end; i++)` kept a double counter when the start had no proven integer range, as in a hash over `[start, end)` whose bounds come from fields. Such a loop is now versioned like one with an unproven limit: when the start is an exact integer of at most 2^53 - 1 in magnitude (compared bit for bit, so -0 takes the original loop), the integer-counter copy runs. The usual bounds on duplicated bodies apply.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
for (let i = start; i < end; i++)kept a double counter when the start had no proven integer range, as in a hash over[start, end)whose bounds come from fields. Such a loop is now versioned like one with an unproven limit. When the start is an exact integer of at most 2^53 − 1 in magnitude, the integer-counter copy runs. The test compares bit patterns, so −0 takes the original loop. The usual bounds on duplicated bodies apply.On its own this is within noise on tsc-ts as it stands. It is what lets tsc-ts drop the subarray views in its comment and template scanners (tsc-ts PR below), which gives tRPC −2.5 points and Excalidraw −1.6 points. Corpus additions in
exact-index-round-trip.tsobserve the counter itself (−0, fractions, NaN, ±2^53, 1e300, −Infinity starts). Unit test ininteger-loops.test.ts.Fourth of four. Whole-stack effect on tsc-ts (with two small tsc-ts scanner commits): parse −9 to −11%, single-threaded total −2.5 to −5.7%,
--checkers 8wall −1.9 to −10.1%, diagnostics identical.