Repository navigation
perf(comp): a shared type read only by peeks keeps its fields uncounted (frozen nodes) - #55
Merged
Merged
Conversation
…uncounted (frozen) A type made shared (the ctr fact) seals every box field of every node on build: a count cell per field, so that a shared read can take the node's fields. A constructor whose nodes no match takes (no owned match of it anywhere, no borrowed read of it in a unit that keeps a lent word or answers a borrowed part) is frozen: its builds store fields plain, its root alone is counted when shared, every read peeks it and the last drop frees it whole. interval-tree's chunk lists (read 406M times through a count cell each) and its query tree: -35% cycles, -30% at 10 threads. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… field A thaw that changes no build added a fact and so, at times, a c_units round (emit time +4% median over the 244 benchmarks); now none (0.999), C the same. Co-Authored-By: Claude Opus 5.5 <[email protected]>
nicolas-abril
added a commit
that referenced
this pull request
Dec 1, 2026
…33, #34, #36, #39, #44, #61-#68): record their heads Each is a port onto main of integration's own branch, its content already here (integration keeps the original commits; the ports add type fixes, line wraps, moved pieces and #68's book_passes, applied in the previous commit). Groups: #61 (#9 #11 #15 #32 #41 #42), #62 (#26 #56), #63 (#48 #50 and compile-time), #64 (#19 #20 #45), #67 (#55 #58), #68 (#54); par-defer (#43) is now part of #34, lazy-startup's parts are in #16 and #34. This merge records their heads (-s ours: no content change). Co-Authored-By: Claude Opus 5.5 <[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.
A shared type's node keeps its box fields uncounted when nothing ever takes them: a representation chosen by how the program reads the type.
What. When a value of a type is shared, the type gets the
ctrfact and every node of every constructor seals its box fields on build: a count cell per field, so that a shared read (ctr_take) can take the fields. A constructor is frozen when no match ever takes its node: no owned match of it anywhere, and no borrowed read of it in a unit that keeps a lent word (term_keepof a+root) or answers a borrowed part (FL.rets). A frozen constructor's builds store fields plain; when its value is shared only the root is counted; every read peeks it (term_peek), and the last drop frees the whole structure. Not for runtime-laid or foreign-named types; a node of words alone is left as it was (its seal is a no-op). The thaw facts join thec_unitsfixed point (a thaw is a fact only for a shared constructor with a box field, so no extra rounds).Where it pays. Found by a survey of the 244 benchmarks with run-time node counters: interval-tree's chunk lists are built once and walked 406M times through borrowed reads, each step loading a count cell and then the node. The other three programs whose C changes are the delaunay ports.
All other 240 benchmarks emit byte-identical C. Emit time over the 244: level (median ratio 0.999).
Checks. Cluster test gate 1996/1996. New tests
tests/run/frozen_{walk,match,keep,back}.bend(frozen lists and trees shared across forks; nested, two-scrutinee and catch-all borrowed matches; a lent read that becomes owned; a tree taken from a generic box by an owned match). All 9 tests whose C changes: same output as the interpreter, 0 live words with-DBEND_POISONat 1 and 8 threads. Wrong versions: no thaw on an owned match (fail-stop on frozen_keep and frozen_back), seal never (crash/fail-stop): caught. The keep and borrowed-answer thaws are defensive: with either removed, no benchmark's C changes (in the corpus an owned match always thaws first). GPU: the 17 bend-runtime programs at--gpu on(C unchanged for them).comp.ts +381 ttok.
🤖 Generated with Claude Code