Skip to content

Brief 011: _total linear in |Omega| (Q18) - #16

Merged
gfrmin merged 2 commits into
masterfrom
b/011-total
Oct 2, 2026
Merged

gfrmin merged 2 commits into
masterfrom
b/011-total

Conversation

@gfrmin

@gfrmin gfrmin commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Brief 011: _total is linear in |Ω| (Q18). Kit-neutral: no act, value or refusal name changes; no page or kit change.

What changed (the builder's commit 2d88d9c; plan in briefs/011-plan.md)

  • Why it was quadratic: _total checks that a table over Omega is a function on Omega. It asked state not in omega and state not in table with both sides as tuples, and a membership test on a tuple is a scan. Each check therefore cost up to |Ω|² comparisons, 4.3 × 10⁸ at 20,736 states. The 16 checks ran three times per load_pack + declare.
  • The fix: each side is turned into a set once per call. Exact rationals are unchanged, no cache outlives the call, and no check is skipped.
    • The gaps and the strangers are still listed in the order the pack wrote them, so a refusal reads as it always has. tests/test_total.py pins this.
  • tools/total_scaling.py measures declare and _total's share of it on synthetic Worlds.

Measured

Synthetic, tools/total_scaling.py:

|Ω| master brief 011
1,000 0.17 s (_total 88%) 0.02 s (4%)
2,000 0.66 s (94%) 0.04 s (5%)
4,000 2.60 s (97%) 0.09 s (5%)

The Renavon packs (renavon-monorepo world/turn-three, c514864f), timing wald.declare(wald.load_pack(text, root)) as the host does. The author measured these on steel on 2026-10-02, with master at b47fe2d:

pack master brief 011 census Plate.values() at the prior
renavon.py (20,736 states) 223.0 s 11.9 s data 7, elicited 20,997: identical identical text
renavon_at_breakeven.py 162.8 s 10.8 s data 7, elicited 20,951: identical identical text

Both are under the brief's 60 s. The next frame in Q18's profile is the Score, which is not this brief's.

The kit

The cage check on this PR, under kit-v0.14. Before brief 012 landed, my local run of master with this branch merged showed exactly master's failures and no new ones.

🤖 Generated with Claude Code

builder and others added 2 commits October 1, 2026 22:44
… (Q18); plan, test, tools/total_scaling.py

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gfrmin
gfrmin merged commit ab72d92 into master Oct 2, 2026
1 check passed
@gfrmin
gfrmin deleted the b/011-total branch October 2, 2026 12:23
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