Repository navigation
comp.ts simplifications: ty_holds, CID_T, tele_fill, corpus_at and more - #1457
Merged
Merged
Conversation
ty_holds looks into every datatype but the words itself, so its tests say only what they seek, true or false: ty_value, ty_clo, lay_of's recursion and js_marshal's Nat no longer spell the walk out. lay_el names its formers inline, task_deliver names its count cell once, gpu_load fails once with the message that fits, and corpus_setup and main drop their one-use temporaries. Every test emits the same JS, and the same C but for those lines. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…tright [].every is true, so term_const's empty-argument case was the general one. lay_el's non-datatype branch returned lay_of(A), which is BOX for anything that is not a datatype; it returns BOX, and the Lay comment says a former is a box whatever its parts mention. mat_ctrs breaks its nested ternary where it nests. Every test and bench emits the same C and JS. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
node_fields picks its scratch reads and its sp source in one expression each, no longer patching strings; emit_open names a parameter's words and marks the borrowed ones in one pass; show_main's node looks up its cache before computing what a miss needs. Every test and bench emits the same C and JS. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The show descriptor's constructor names are filtered once for the roots and SHOW_NAMES; cid() stores a constructor's encoded arity where it is met, so the ars array zipped with cids goes; js_def asks def_foreign. Every test and bench emits the same C and JS. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
corpus_map's hint loop and corpus_grow's doubling both tried a mapping at a fixed address and unmapped one that landed elsewhere; corpus_at does it for both. Host-only: once at startup, and on each doubling. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Four callers spelled out Bend.tele_fill(FL.book, T, xs, Bend.ctx_nil()); the Tele section names it beside tele_unbind. Every test and bench emits the same C and JS. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A predicate answers whether a type is the one sought; ty_holds looks into each datatype it rejects, but for the words. ty_value and ty_clo reject "ADT" for that reason. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Lorenzobattistela
approved these changes
Oct 10, 2026
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.
Behaviour-preserving simplifications of
bend2/comp.ts. They free 183 ttok (63,905 → 63,722). Each commit covers one area:ty_holdsnow looks inside every datatype except the words itself, so its predicate just returnstrue/falsefor what it is looking for.ty_value,ty_clo,lay_of's recursion check andjs_marshal'sNattest no longer spell out the walk.lay_elwrites its type formers inline.task_delivercomputes its count cell once.gpu_loadhas one failure path.corpus_setupand Cmaindrop their one-use temporaries.term_const's deadlength === 0guard ([].everyis alreadytrue).lay_elreturnsBOXdirectly for type formers, wherelay_ofalways gaveBOXon that branch.mat_ctrsso its nested ternary reads the way it parses.node_fieldsbuilds its scratch reads without patching strings.emit_opennames a parameter's words and marks the borrowed ones in one pass.show_main'snodechecks its cache before computing anything.SHOW_NAMES.cid()stores each encoded arity where the constructor is met, so thearsarray zipped by index withcidsis gone.js_defusesdef_foreign.tele_unbindfor the fourBend.tele_fill(FL.book, T, xs, Bend.ctx_nil())calls.corpus_mapandcorpus_growboth repeated.Hot runtime paths and device code were deliberately left alone. During the drop work on #1438, an "obvious" merge of
ctr_take's two loops cost about 6% on lexer's Metal run.Validation
#|test and all 17 runtime benches give byte-identical JS and compiler logs tomain. Every.cfile differs only in thetask_deliver,gpu_load,corpus_setup,mainandcorpus_atlines. That was checked per commit, and again for the combined branch, where all 762 C diffs are identical._run.tsruns on the first commit, perf came back 123/124. The full perf tables put the closest cells atmerkleCOMPILER andgenerics_3200CHECKER, which are near the 1.15× limit onmaintoo. Alternating rounds againstmainpassed 124/124 every time.corpus_grow: exercised with an 8 GiB array, so the arena doubled twice through the new helper. Metal builds and--gpu on/offoutputs matchmain.tsc: no errors incomp.ts.#1438 carries the first commit too. Once this lands, it rebases onto it.
🤖 Generated with Claude Code