Repository navigation
The compiler says the same in 658 fewer tokens, with the same output and compile time - #1235
Merged
Merged
Conversation
…and compile time comp.ts goes from 63,765 to 62,919 ttok, 1,081 under its 64k cap. Every JS and C file the 1197 Base tests emit, and every refusal, is byte for byte the same, and the .mjs path is the same on a 107-test sample. Duplicates are said once: js_ctr is ctr_live, under ctr_doms; the two argument folds are fold_args; "a def that runs" is def_runs. Single-caller helpers are inlined (compile_tables, compile_reqs, compile_segs, emit_frame, book_owned, arr_lay; js_tail folds into js_call), and the rest is tighter expressions and inferred annotations. Three changes also save work: io_base overlays IO on book.tlds instead of copying the table once per def, ctr_tail no longer memoizes a telescope it just built (never hit, never freed), and file_book walks its queue instead of shifting it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…es keep a line per field, and a function is named for its section The ifs the pass folded into conditionals are ifs again (term_force, mat_rows, facts_hot, file_book, emit_args, emit_expr, emit_match, emit_chain, js_call, js_match), and the OPERATIONS entries with more than one field are multi-line again. live_dom is dom_live under its own Dom section, def_runs is fun_runs and fold_args is emit_fold_args. Output is byte for byte the same; comp.ts is 63,107 ttok. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
nicolas-abril
added a commit
to costamatheus97/bend
that referenced
this pull request
Oct 1, 2026
…nt rows, the main thread takes rows, and a turn visits only the rows that can hold a task bendlang#1092's five commits, squashed onto main. The emitter cleanups its last commit carried are already on main (bendlang#1235); the column grow keeps bendlang#1171's row per thread, and a column grow still opens every row to the turns. Co-Authored-By: Nicolas Abril <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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.
Context
gates/repo.tscapsbend2/comp.tsat 64k ttok, and it was at 63,765, leaving 235 tokens of headroom. This PR frees room under the cap without changing what the compiler emits.Change
comp.tsgoes from 63,765 to 63,107 ttok (−658), so it is now 893 under the cap. Only the TypeScript half changed. The embedded C runtime and the runtime text strings are untouched.The file's style is kept: no if is folded into a conditional expression, OPERATIONS entries with more than one field keep a line per field, every new or renamed function starts with its section's name, no added line passes 80 columns, and
tscreports no new errors.js_ctrwasctr_domswithout its final map. It is nowctr_live, andctr_domsis built on it.live_domis nowdom_live, back in its own// Domsection.emit_foldandemit_unfoldnow shareemit_fold_args.fun_runs. It was written out by hand in four places.compile_tables,compile_reqsandcompile_segsnow live incompile_book, which grows to about 125 lines. Splittingcompile_tablesback out would cost about 23 tokens.emit_frame,book_ownedandarr_layare inlined into their callers.js_tailis folded intojs_call. A tail call now records its callee infl.tailsup front, without thefl.seg.def !== ""guard. The extra entries are never read, because the callee is never a def with tail calls of its own, and output is unchanged.io_baseoverlaysIOonbook.tldswithObject.create, the waybend.tsdoes, instead of copying the whole table on each call. The.mjspath calls it once per def. It is also no longer exported.ctr_tailno longer memoizes a telescope it just filled, which never hit and was never freed.file_bookiterates its queue instead of callingshift().Checks
.jsand.cand every error log are byte-identical tomain. A 107-test sample of-o x.mjsis also identical.bench/runtimeprograms, 20 runs each, againstmain(measured before the style commit, which only restoresmain's own code or renames functions). C output totals 1401 → 1396 ms (−0.3%) and JS 1116 → 1112 ms (−0.4%). No bench moves outside noise. Two edits I tried had made C builds about 1% slower and were reverted:term_const's shortcut for constructors with no fields;lay_of's key before its early return for word types.tscreports no errors incomp.ts.bun gates/repo.tspasses (49/49).gates/test.ts,gates/perf.ts) weren't run. The runtime is unchanged and the emitted code is byte-identical, so the programs those gates run are the same.🤖 Generated with Claude Code