Skip to content

Use values for topology target selectors - #146

Merged
SandroMaglione merged 1 commit into
mainfrom
codex/value-target-selectors
Aug 19, 2026
Merged

Use values for topology target selectors#146
SandroMaglione merged 1 commit into
mainfrom
codex/value-target-selectors

Conversation

@SandroMaglione

Copy link
Copy Markdown
Member

Summary

  • make definition-time topology instructions immutable values while keeping state, choice, and runtime branch evidence builders callable
  • adopt target-first machine initial entry with once-only selector capture and lazy resolver execution
  • remove Machine.targetless in favor of (to) => to.none, migrate the repository, and preserve exact transition/lifecycle inference and compiled metadata
  • reject active or choice child keys that collide with the reserved initial and schema-backed local with selector properties

Changeset

  • Added or updated for a library or package-metadata change
  • Not required because this PR does not change src/ or package.json

Validation

  • pnpm check
  • Relevant example checks, when examples changed
  • Automated type-performance measurement passed or was not required
  • Automated runtime- and memory-performance measurement passed or was not required

Affected example checks passed for platformer, playground, and pokemon. Local type-performance budgets and the runtime/memory smoke suite passed; CI base-versus-PR reports remain authoritative.

@github-actions

Copy link
Copy Markdown
Contributor

Type performance

Measured with TypeScript 6.0.3 and skipLibCheck=true.

Scenario Base PR Difference
Effect only 55 55 0 (0.0%)
Import effect-machine 55 55 0 (0.0%)
Machine.states (3 states) 3,039 3,039 0 (0.0%)
Machine.make (3 states, 2 events) 10,439 10,761 +322 (+3.1%)
machine.handle (3 states, 2 transitions) 32,036 29,177 -2,859 (-8.9%)
fluent transition (10 named branches) 119,749 109,470 -10,279 (-8.6%)
Machine.invoke (state-dependent Effect) 93,494 92,024 -1,470 (-1.6%)
machine.handle (depth 24) 205,744 198,478 -7,266 (-3.5%)
machine.handle (wide depth 16) 237,098 229,624 -7,474 (-3.2%)
machine.handle (parallel/history/choice) 141,115 133,024 -8,091 (-5.7%)
machine definition (3 independent implementations) 140,991 132,018 -8,973 (-6.4%)
machine exact input/output/error/services 126,285 117,186 -9,099 (-7.2%)
execution adapter readiness 135,186 126,635 -8,551 (-6.3%)

Marginal instantiations are measured against the matching setup without that API call:

Scenario Base PR Difference
Import effect-machine 0 0 0
Machine.states (3 states) 2,984 2,984 0 (0.0%)
Machine.make (3 states, 2 events) 7,392 7,714 +322 (+4.4%)
machine.handle (3 states, 2 transitions) 21,597 18,416 -3,181 (-14.7%)
fluent transition (10 named branches) 109,820 99,219 -10,601 (-9.7%)
Machine.invoke (state-dependent Effect) 84,648 82,757 -1,891 (-2.2%)
machine.handle (depth 24) 186,054 177,780 -8,274 (-4.4%)
machine.handle (wide depth 16) 218,407 210,133 -8,274 (-3.8%)
machine.handle (parallel/history/choice) 121,439 112,757 -8,682 (-7.1%)
machine definition (3 independent implementations) 125,445 116,045 -9,400 (-7.5%)
machine exact input/output/error/services 112,194 102,673 -9,521 (-8.5%)
execution adapter readiness 103,709 95,462 -8,247 (-8.0%)
Check times (informational)
Scenario Base PR
Effect only 0.02s 0.02s
Import effect-machine 0.02s 0.02s
Machine.states (3 states) 0.07s 0.07s
Machine.make (3 states, 2 events) 0.12s 0.12s
machine.handle (3 states, 2 transitions) 0.20s 0.20s
fluent transition (10 named branches) 0.41s 0.40s
Machine.invoke (state-dependent Effect) 0.36s 0.35s
machine.handle (depth 24) 0.61s 0.59s
machine.handle (wide depth 16) 0.61s 0.60s
machine.handle (parallel/history/choice) 0.48s 0.46s
machine definition (3 independent implementations) 0.49s 0.47s
machine exact input/output/error/services 0.45s 0.44s
execution adapter readiness 0.46s 0.45s

Type instantiations are the comparison metric. Check time varies with runner load and is informational only.

@github-actions

Copy link
Copy Markdown
Contributor

Runtime performance

Median of 5 independent benchmark processes on AMD EPYC 7763 64-Core Processor with Node v24.19.0.

Pull request baseline

Scenario Effect Machine
Plan counter transitions 114,007 transitions/s
Drain burst with terminal fence 345,430 increments/s
Drain burst with a change observer 324,903 increments/s
Lookup and send to one child 286,387 increments/s
Start and stop a machine 140,766 machines/s
Start and stop a parent with one child 27,452 families/s
Plan transitions through a compound state 98,063 transitions/s
Plan transitions through parallel regions 80,661 transitions/s
Drain burst through a compound state 297,448 events/s
Drain burst through two parallel regions 300,114 events/s
Drain a compound-state burst with a change observer 278,298 events/s

Process runtime reference points

Scenario Effect Machine
Start and stop a raw generic process 15,156 processes/s
Start and stop a raw compiled process 61,308 processes/s
Memory profile Effect Machine
Idle machine 1.8 KiB
Raw generic managed process 13.9 KiB
Raw compiled process 3.1 KiB
Two independent idle machines 3.4 KiB
Idle parent with one child 5.8 KiB
Parent with observed child registry 10.0 KiB
Parent with observed invoked child snapshots 6.3 KiB

Effect Machine change from base

Metric Base Base variability PR PR variability Difference
Plan counter transitions 107,731 transitions/s 0.7% MAD 114,007 transitions/s 1.6% MAD +5.8%
Drain burst with terminal fence 332,803 increments/s 0.9% MAD 345,430 increments/s 0.4% MAD +3.8%
Drain burst with a change observer 313,145 increments/s 1.2% MAD 324,903 increments/s 0.3% MAD +3.8%
Lookup and send to one child 274,758 increments/s 1.5% MAD 286,387 increments/s 0.1% MAD +4.2%
Start and stop a machine 138,447 machines/s 0.6% MAD 140,766 machines/s 0.3% MAD +1.7%
Start and stop a parent with one child 27,803 families/s 4.1% MAD 27,452 families/s 1.8% MAD -1.3%
Plan transitions through a compound state 94,311 transitions/s 1.0% MAD 98,063 transitions/s 2.8% MAD +4.0%
Plan transitions through parallel regions 76,112 transitions/s 0.8% MAD 80,661 transitions/s 0.4% MAD +6.0%
Drain burst through a compound state 289,514 events/s 1.9% MAD 297,448 events/s 0.8% MAD +2.7%
Drain burst through two parallel regions 290,644 events/s 0.9% MAD 300,114 events/s 0.5% MAD +3.3%
Drain a compound-state burst with a change observer 272,812 events/s 1.4% MAD 278,298 events/s 0.6% MAD +2.0%
Idle machine heap per unit 1.8 KiB 0.0% MAD 1.8 KiB 0.2% MAD -0.0%
Raw generic managed process heap per unit 13.9 KiB 0.0% MAD 13.9 KiB 0.0% MAD -0.0%
Raw compiled process heap per unit 3.1 KiB 0.1% MAD 3.1 KiB 0.2% MAD +0.2%
Two independent idle machines heap per unit 3.4 KiB 0.0% MAD 3.4 KiB 0.1% MAD -0.0%
Idle parent with one child heap per unit 5.8 KiB 0.0% MAD 5.8 KiB 0.0% MAD -0.0%
Parent with observed child registry heap per unit 10.0 KiB 0.0% MAD 10.0 KiB 0.0% MAD -0.0%
Parent with observed invoked child snapshots heap per unit 6.3 KiB 0.0% MAD 6.3 KiB 0.0% MAD +0.1%

Process runtime reference change from base

Metric Base Base variability PR PR variability Difference
Start and stop a raw generic process 15,114 processes/s 3.9% MAD 15,156 processes/s 2.3% MAD +0.3%
Start and stop a raw compiled process 60,533 processes/s 1.1% MAD 61,308 processes/s 0.9% MAD +1.3%

Regression guard

No large, noise-adjusted throughput or heap regressions detected.

Versions and interpretation
  • Effect Machine: 0.16.0

Higher throughput is better; lower heap is better. Variability is the median absolute deviation across independent processes, relative to their median. Small differences on shared GitHub-hosted hardware remain informational; the required guard rejects only large changes beyond the measured noise allowance.

@SandroMaglione
SandroMaglione merged commit a5c910a into main Aug 19, 2026
13 checks passed
@SandroMaglione
SandroMaglione deleted the codex/value-target-selectors branch August 19, 2026 10:09
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