Skip to content

perf(parse): field names, array updates, namespaces and later match parameters are found without rescans - #2062

Merged
nicolas-abril merged 3 commits into
bendlang:mainfrom
nicolas-abril:perf/complexity-simple
Nov 6, 2026
Merged

nicolas-abril merged 3 commits into
bendlang:mainfrom
nicolas-abril:perf/complexity-simple

Conversation

@nicolas-abril

@nicolas-abril nicolas-abril commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

This PR edits bend2/bend.ts, which AGENTS.md marks as human-written. It was opened at Nicolas's request, as a proposal for the file's owner to review, rewrite or close.

Three small fixes from the complexity issues, each a few lines, none changing what the parser builds.

The rest of #2022 and #2046, and the other complexity issues, need larger changes. The parse_var scope scan from #2046 comes in a separate PR.

Load times (in-process book_load, best of 12, machine under load)

program main this PR
a call of 2000 arguments inside 2000 groups (#2022) 91–100 ms 12–22 ms
a constructor with 4000 fields (#2005) 142–237 ms 23–39 ms
a match on the last of 2000 parameters (#2046) 28–30 ms 10–11 ms

Checks

  • Every .bend file under tests/ (1851 files) prints the same output with --check-only as on main, error messages included. Among them, 19 tests use x[i] <- v, 234 use namespaced operators, and 16 hit the match-lowering errors.
  • bend.ts 45508 → 45590 ttok (cap 48000).
  • Gates (_run.ts): repo 56/56, ping 83/83. Test 1833/1838 fails only io/gfx tests with Permission denied from 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

…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>
nicolas-abril and others added 2 commits November 5, 2026 20:59
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n one scan

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nicolas-abril
nicolas-abril merged commit e75ccac into bendlang:main Nov 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant