Skip to content

Stop list searches once the answer is known - #1730

Merged
Lorenzobattistela merged 1 commit into
bendlang:mainfrom
oxura:fix/short-circuit-list-searches-20261019b
Oct 20, 2026
Merged

Lorenzobattistela merged 1 commit into
bendlang:mainfrom
oxura:fix/short-circuit-list-searches-20261019b

Conversation

@oxura

@oxura oxura commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

List.any, all, contains, and find were still evaluating a tail predicate after the head had already decided the answer. A later Nat overflow could make a successful search crash in both C and emitted JS.

Defer the tail behind a runtime callback and call it only when needed. The existing neutral-tail identities still pass --verdict; the new regression and three existing list consumers run in both backends. Repo gate: 54/54. I did not run the private gates.

There is a full-scan cost: about 6–8 ms extra per two million predicate calls in my local native workload. Early exits no longer evaluate the unused tail. No compiler/checker changes or GUIDE edits.

Closes #1726
Closes #1727
Closes #1728
Closes #1729

@Lorenzobattistela Lorenzobattistela self-assigned this Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants