Repository navigation
perf(parse): field names, array updates, namespaces and later match parameters are found without rescans - #2062
Merged
nicolas-abril merged 3 commits intoNov 6, 2026
Conversation
…arameters are found without rescans parse_tele checks duplicate field names with a set (bendlang#2005). term_write follows at most five call links, and parse_term_ns takes the namespace type's head from its caller instead of reading it per operator (bendlang#2022). match_flatten wraps all the parameters before the matched one in one pass instead of searching and copying the list per parameter (bendlang#2046). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n one scan Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Three small fixes from the complexity issues, each a few lines, none changing what the parser builds.
parse_telerejected a duplicate field by comparing it with every earlier field (tele.some). ASetof the names seen now answers it: O(n) for n fields instead of O(n²).term_writecollected every argument of a group's call to test whether it is a four-argumentArray.set, once in each enclosing group. It now follows at most five links: a fifth already rules the form out.parse_term_nsread the namespace type's head again at every operator it renamed. Its callers now read the head once and pass it in.match_flattenwrapped one parameter at a time, searching and copying the parameter list again at each step. It now finds the parameter once and wraps the k parameters before it in one pass. The lambdas come out the same and in the same order, and the skipped steps could never take another branch: the only test before them does not depend on which parameter is first.The rest of #2022 and #2046, and the other complexity issues, need larger changes. The
parse_varscope scan from #2046 comes in a separate PR.Load times (in-process
book_load, best of 12, machine under load)Checks
.bendfile undertests/(1851 files) prints the same output with--check-onlyas on main, error messages included. Among them, 19 tests usex[i] <- v, 234 use namespaced operators, and 16 hit the match-lowering errors.bend.ts45508 → 45590 ttok (cap 48000)._run.ts): repo 56/56, ping 83/83. Test 1833/1838 fails only io/gfx tests withPermission deniedfrom stale/tmp/bend_io_*files on cluster nodes, as on main. Perf 119–121/124 fails the same cluster cells as main does today: merkle and nbody, compile and GPU time. Two earlier runs hit the 30 s cap while the local machine sat at load 20–28; ping passed 83/83 on its own in 8 s.🤖 Generated with Claude Code