Repository navigation
comp.ts sheds 586 tokens: tighter runtime and comments, a pure main prints through Bend code (from #1817) - #1829
Closed
Lorenzobattistela wants to merge 5 commits into
Closed
Lorenzobattistela wants to merge 5 commits into
Lorenzobattistela wants to merge 5 commits into
Conversation
…hter comments Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
main_pure, taken from #1817, writes a printer of main's type as Bend source and checks it in a copy of the book; it replaces the descriptor built by show_main and the C and JS printers that read it. Base gains U32.hex, Char.quote, String.quote, F32.show.dot, Array.write and Array.show. lay_eq walks the layout DAG (also from #1817): the printer's defs take deep shared layouts, which JSON comparison expanded exponentially (tests/reg/show_shared_layout.bend took 93 s to build). comp.ts: 65,880 -> 65,414 ttok. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A printer is @unsafe, so the printers of types that hold each other (a Rose through its List, mutually recursive datatypes) can call each other; before, the printer written first named one checked later, a dead claim. An Array's element type is a closed ~ argument: one that depends on a field is refused, and the printer's locals are renamed past the names in its text, so a def named x or s stays the user's. The Data-kind check runs on the book's copy. Co-Authored-By: Claude Opus 5.5 (1M context) <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.
comp.ts goes from 66,000 to 65,414 ttok (−586), leaving room under the 66k cap.
Trims (−120)
term_peek,rfc_seal,term_keepandblk_readin the C runtime are one-line ternaries.ty_key(t)replaces five copies ofBend.term_key(Bend.term_lower(t)).A pure main prints through Bend code (−466, from #1817)
main_pure, taken from comp.ts: nothing reads emitted text, pure mains print through Bend #1817, writes a printer of main's type as Bend source and checks it in a copy of the book. It replaces the descriptorshow_mainbuilt and the C and JS printers that read it.U32.hex,Char.quote,String.quote,F32.show.dot,Array.writeandArray.show, and comp.ts: nothing reads emitted text, pure mains print through Bend #1817's four printer tests come along (tests/show/array_elements,imported_adt*).lay_eqwalks the layout DAG, also from comp.ts: nothing reads emitted text, pure mains print through Bend #1817. The printer's defs take deep shared layouts, which comparing JSON expanded exponentially:tests/reg/show_shared_layout.bendtook 93 s to build without it.Verification
MAIN_PURE(0 for them) already compiled out.cc -O3host assembly is identical to main's for all 17 runtime benches, before and after the port. Metal device IR was identical too before the port.🤖 Generated with Claude Code