Skip to content

Index hierarchical machine configuration - #63

Merged
SandroMaglione merged 1 commit into
mainfrom
codex/indexed-machine-configuration
Aug 9, 2026
Merged

Index hierarchical machine configuration#63
SandroMaglione merged 1 commit into
mainfrom
codex/indexed-machine-configuration

Conversation

@SandroMaglione

Copy link
Copy Markdown
Member

Summary

  • compile eligible compound and parallel machines into numeric topology and per-leaf event dispatch tables
  • retain active values and completion metadata in a compact indexed configuration while draining, materializing public snapshots only at process boundaries
  • preserve general-planner fallback semantics and add explicit compiled-hierarchy resume coverage

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 (not applicable)
  • Reviewed the automated type-performance report, when the public TypeScript API or inference changed (no public type change; pnpm perf:types passes)
  • Reviewed the automated runtime-performance report, when runtime behavior changed

Local five-process interleaved base-versus-branch validation found +21.5% compound throughput and +22.8% parallel throughput, with unchanged measured heap profiles and unrelated runtime metrics within noise.

@github-actions

github-actions Bot commented Aug 9, 2026

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.defineStates (3 states) 2,965 2,965 0 (0.0%)
Machine.make (3 states, 2 events) 8,715 8,715 0 (0.0%)
machine.handle (3 states, 2 transitions) 23,492 23,492 0 (0.0%)
machine.handle (depth 8) 117,075 117,075 0 (0.0%)
machine.handle (depth 12) 129,713 129,713 0 (0.0%)
machine.handle (depth 16) 145,055 145,055 0 (0.0%)
machine.handle (depth 24) 183,851 183,851 0 (0.0%)
machine.handle (wide depth 16) 214,189 214,189 0 (0.0%)
machine.handle (parallel/history/choice) 132,667 132,667 0 (0.0%)
machine.handle (4 successive calls) 128,674 128,674 0 (0.0%)
machine exact input/output/error/services 110,584 110,584 0 (0.0%)
execution adapter readiness 127,854 127,854 0 (0.0%)

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

Scenario Base PR Difference
Import effect-machine 0 0 0
Machine.defineStates (3 states) 2,910 2,910 0 (0.0%)
Machine.make (3 states, 2 events) 5,742 5,742 0 (0.0%)
machine.handle (3 states, 2 transitions) 14,777 14,777 0 (0.0%)
machine.handle (depth 8) 109,601 109,601 0 (0.0%)
machine.handle (depth 12) 121,039 121,039 0 (0.0%)
machine.handle (depth 16) 135,181 135,181 0 (0.0%)
machine.handle (depth 24) 171,577 171,577 0 (0.0%)
machine.handle (wide depth 16) 202,224 202,224 0 (0.0%)
machine.handle (parallel/history/choice) 114,331 114,331 0 (0.0%)
machine.handle (4 successive calls) 113,703 113,703 0 (0.0%)
machine exact input/output/error/services 100,670 100,670 0 (0.0%)
execution adapter readiness 102,092 102,092 0 (0.0%)
Check times (informational)
Scenario Base PR
Effect only 0.03s 0.03s
Import effect-machine 0.03s 0.03s
Machine.defineStates (3 states) 0.10s 0.10s
Machine.make (3 states, 2 events) 0.16s 0.16s
machine.handle (3 states, 2 transitions) 0.22s 0.23s
machine.handle (depth 8) 0.51s 0.52s
machine.handle (depth 12) 0.57s 0.55s
machine.handle (depth 16) 0.60s 0.62s
machine.handle (depth 24) 0.70s 0.70s
machine.handle (wide depth 16) 0.76s 0.80s
machine.handle (parallel/history/choice) 0.63s 0.63s
machine.handle (4 successive calls) 0.60s 0.58s
machine exact input/output/error/services 0.53s 0.53s
execution adapter readiness 0.57s 0.56s

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

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Runtime performance

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

Pull request baseline

Scenario Effect Machine XState 5 XState 6 alpha
Plan counter transitions 119,077 transitions/s 132,933 transitions/s 121,080 transitions/s
Drain burst with terminal fence 231,993 increments/s 389,442 increments/s 110,684 increments/s
Drain burst with a change observer 152,323 increments/s 386,984 increments/s 110,058 increments/s
Lookup and send to one child 199,989 increments/s 384,544 increments/s 105,442 increments/s
Start and stop a machine 26,532 machines/s 186,220 machines/s 72,537 machines/s
Start and stop a parent with one child 9,351 families/s 69,314 families/s 26,617 families/s
Drain burst through a compound state 291,019 events/s 342,772 events/s 109,155 events/s
Drain burst through two parallel regions 273,549 events/s 259,159 events/s 91,694 events/s

Effect runtime reference points

Scenario Effect Machine Effect runtime primitives
Start and stop a raw compiled process 34,716 processes/s
Start and interrupt a suspended fiber 164,989 fibers/s
Start and stop a queue worker 114,077 workers/s
Start and stop an actor shell 106,530 actors/s
Start and stop two actor shells 60,676 families/s
Update an owner-only mutable snapshot 316,856,781 updates/s
Update a synchronized snapshot 1,527,774 updates/s
Create, resolve, and await a terminal latch 1,452,262 latches/s
Memory profile Effect Machine XState 5 XState 6 alpha Effect runtime primitives
Idle machine 2.0 KiB 3.8 KiB 6.1 KiB
Raw generic managed process 12.3 KiB
Raw compiled process 2.7 KiB
Two independent idle machines 3.5 KiB 7.3 KiB 11.8 KiB
Idle parent with one child 5.8 KiB 5.5 KiB 8.8 KiB
Parent with observed child registry 10.0 KiB
Parent with observed invoked child snapshots 5.9 KiB
Suspended Effect fiber 0.7 KiB
Effect queue with waiting fiber 2.8 KiB
Effect mailbox actor shell 3.2 KiB
Two Effect actor shells 6.9 KiB

Effect Machine change from base

Metric Base Base variability PR PR variability Difference
Plan counter transitions 116,587 transitions/s 3.0% MAD 119,077 transitions/s 1.0% MAD +2.1%
Drain burst with terminal fence 234,487 increments/s 1.0% MAD 231,993 increments/s 2.8% MAD -1.1%
Drain burst with a change observer 154,405 increments/s 1.3% MAD 152,323 increments/s 2.3% MAD -1.3%
Lookup and send to one child 200,769 increments/s 0.6% MAD 199,989 increments/s 1.3% MAD -0.4%
Start and stop a machine 26,040 machines/s 1.1% MAD 26,532 machines/s 1.6% MAD +1.9%
Start and stop a parent with one child 9,291 families/s 3.3% MAD 9,351 families/s 2.8% MAD +0.6%
Drain burst through a compound state 224,336 events/s 5.5% MAD 291,019 events/s 0.4% MAD +29.7%
Drain burst through two parallel regions 216,175 events/s 0.6% MAD 273,549 events/s 0.1% MAD +26.5%
Idle machine heap per unit 2.0 KiB 0.0% MAD 2.0 KiB 0.0% MAD +0.0%
Raw generic managed process heap per unit 12.3 KiB 0.0% MAD 12.3 KiB 0.0% MAD -0.0%
Raw compiled process heap per unit 2.7 KiB 0.0% MAD 2.7 KiB 0.1% MAD +0.1%
Two independent idle machines heap per unit 3.5 KiB 0.0% MAD 3.5 KiB 0.0% MAD +0.0%
Idle parent with one child heap per unit 5.8 KiB 0.2% MAD 5.8 KiB 0.0% MAD -0.4%
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 5.9 KiB 0.0% MAD 5.9 KiB 0.0% MAD +0.0%

Effect runtime reference change from base

Metric Base Base variability PR PR variability Difference
Start and stop a raw compiled process 34,419 processes/s 1.3% MAD 34,716 processes/s 0.3% MAD +0.9%
Start and interrupt a suspended fiber 166,085 fibers/s 1.2% MAD 164,989 fibers/s 1.0% MAD -0.7%
Start and stop a queue worker 116,198 workers/s 1.0% MAD 114,077 workers/s 1.6% MAD -1.8%
Start and stop an actor shell 107,204 actors/s 0.9% MAD 106,530 actors/s 1.1% MAD -0.6%
Start and stop two actor shells 65,967 families/s 0.9% MAD 60,676 families/s 4.6% MAD -8.0%
Update an owner-only mutable snapshot 317,863,954 updates/s 0.0% MAD 316,856,781 updates/s 0.0% MAD -0.3%
Update a synchronized snapshot 1,520,674 updates/s 2.1% MAD 1,527,774 updates/s 0.7% MAD +0.5%
Create, resolve, and await a terminal latch 1,463,289 latches/s 0.4% MAD 1,452,262 latches/s 0.4% MAD -0.8%
Versions and interpretation
  • Effect Machine: 0.3.0
  • XState 5: 5.32.5
  • XState 6 alpha: 6.0.0-alpha.27
  • Effect runtime primitives: 4.0.0-beta.105

Higher throughput is better; lower heap is better. Variability is the median absolute deviation across independent processes, relative to their median. Runtime measurements on shared GitHub-hosted hardware remain informational, so small differences should be confirmed across multiple workflow runs.

@SandroMaglione
SandroMaglione merged commit 1e4eab6 into main Aug 9, 2026
9 checks passed
@SandroMaglione
SandroMaglione deleted the codex/indexed-machine-configuration branch August 9, 2026 13:39
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