Skip to content

perf(main): the verdict skips its walk set on a book with no promise - #2060

Merged
nicolas-abril merged 2 commits into
bendlang:mainfrom
nicolas-abril:perf/promises-early
Nov 5, 2026
Merged

nicolas-abril merged 2 commits into
bendlang:mainfrom
nicolas-abril:perf/promises-early

Conversation

@nicolas-abril

Copy link
Copy Markdown
Collaborator

book_promises (the --verdict/default check verdict) built own, the deduplicated book.order outside Base, before its early return. So every book with no @unsafe or foreign def paid for a Set over all its defs and then threw it away. This PR collects the two root lists (@unsafe, foreign effects) in one pass over the tlds and builds own only after the early return.

Found while profiling why generics_3200's checker cell sits at 1.12–1.21× its pin. Most of that growth is the parser; this is the part in main.ts.

Measurements (local, min of 9 runs)

bench main this PR
generics_3200 0.399 s 0.393 s
compute_1600 0.513 s 0.503 s
defs_12800 0.315 s 0.313 s
proofs_3200 0.819 s 0.817 s
trees_400 0.623 s 0.622 s

book_promises itself drops from 6.5 ms to about 2 ms on generics_3200.

Checks

  • The verdict output is identical on the 57 tests that print one, including the 17 that list defs relying on unsafe or foreign code.
  • main.ts goes from 13038 to 13049 ttok (cap 16000).
  • Gates (_run.ts): repo 56/56. Perf passed 122/124; the cell over its limit in a second run under the same load was merkle's compile time, which this PR can't affect. Ping fails 2 BendHub publish checks, as on main. Test fails 7 io/gfx tests with Permission denied, as on main: stale /tmp/bend_io_* files owned by another user on cluster nodes 58 and 72–78.

🤖 Generated with Claude Code

book_promises built own (the deduped book.order outside Base) before its
early return, so every book without an @unsafe or foreign def paid for a
Set over every def it then threw away. The two root lists now come from
one pass over the tlds, and own is built after the early return.

generics_3200 (28812 defs, no promise): book_promises 6.5 -> ~2 ms, the
check 0.399 -> 0.393 s (min of 9, local). The verdict text is unchanged
on the 57 tests that print one, the 17 that list promises included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nicolas-abril
nicolas-abril merged commit c2d6f7f into bendlang:main Nov 5, 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