Skip to content

perf: vendor signal graph and trim retained class methods - #1986

Merged
trueadm merged 5 commits into
octanejs:mainfrom
openai-oss-forks:codex/vendor-alien-signal-engine
Oct 11, 2026
Merged

trueadm merged 5 commits into
octanejs:mainfrom
openai-oss-forks:codex/vendor-alien-signal-engine

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Vendor the Alien Signals 3.2.1 graph into Octane's existing signal engine and make unused signal features easier to tree-shake. Twenty internal class methods/getters become direct helpers or are folded into existing callers; graph flags remain primitive numeric constants in production output.

The public signal API, graph algorithms, scope ownership, notification order, and action integration are preserved. The upstream MIT notice and immutable source revision are included. The benchmark package now owns its Alien comparator dependency and checks external and vendored engines explicitly. Octane retains Alien Signals only as a development dependency for repository browser tests and archived comparisons; it is absent from production dependencies.

Complete production JavaScript sizes for integrated head 4d0e0c75 against current base 4ff7d0da (both sides rebuilt before the 0.13.0 release integration; signal implementation remains unchanged at current head 38adefc18):

Fixture Oxc raw delta Oxc gzip delta Oxc Brotli delta esbuild gzip delta
Signal engine -2,721 B -685 B -594 B -606 B
Compiled plain signals -4,475 B -820 B -784 B -812 B
Native reads -2,736 B -637 B -502 B -601 B
Mixed Alien and Octane -864 B -245 B -280 B -9 B
Ordinary TSRX/JSX rows 0 B 0 B 0 B 0 B

Validation

  • pnpm sync; generated binding/corpus changes only update lock hashes.
  • pnpm typecheck:files: 13 source/test/fixture files after integration, including the imported .tsrx fixture explicitly so the scoped checker enables JSX.
  • Scoped formatting and git diff --check.
  • Thirty original public-signal cases cover graph subscriptions, batching, and feedback; owning scope/resource/action checks and native ESM entry-order checks also pass.
  • Benchmark repair: 35 boundary cases, 11 workload cases, default/explicit engine and native smokes, and matched current/archived boundary builds.
  • Fixed-base Node Oxc comparison (8c09d815 vs the pre-integration vendoring snapshot): eight balanced four-version groups, 32 fresh processes, identical counts and semantic checks. The final candidate has no resolved slowdown interval versus baseline, including either execution order. Dynamic sparse writes are 2.44% faster (interval -4.93% to -1.26%); dynamic batches have a -4.31% point estimate (interval -5.38% to +0.13%).
  • Fixed-base installed Chrome 156 comparison (same pre-integration sources): 32 fresh processes, eight actual and eight identical-code pairs, with fixed counts and per-step semantic qualification. No resolved slowdown interval in the 12 measured mount/update operations or either execution order. Single-return prop updates improve 1.68% (interval -3.86% to -1.11%). All 2,304 retained windows exceed 20 ms.
  • Integrated 4ff7d0da without conflicts. Independent source review verified the exact union of vendoring and incoming pacing/unwind/compiler changes; 1,085 fresh integration test executions passed (493 development, 493 production, 99 Node), plus 46 benchmark boundary/workload cases.
  • Comparator ownership repair: 47 benchmark boundary/workload/initial-document cases pass. Scoped format and sync pass; the existing Alien 3.2.1 dev importer is the only new lock entry, with no version/integrity changes.
  • Current-head CI passes on 38adefc18 against release base e4d5908, including full lint/types/tests, browser integration, parity, publishable packages, frozen installation, release-plan validation, and CI provenance. Sync and independent source/metadata review also pass.
  • Current-head PR benchmark: all 64 work counters unchanged, no timing verdict beyond the ±3% threshold; ordinary application sizes unchanged, public hydrate-frame down 410 gzip bytes.
  • Full pnpm format:check, pnpm typecheck, and sharded pnpm test pass in CI; local checks remain the scoped runs above.
  • perf-review: fixed-base mechanical scan reports zero candidates. Independent structural review found no new instance fields, receiver types, per-node allocations, DOM operations, or scheduling hops. The existing action bridge retains one module-time flag table. The owning Node and browser checks detected no regression within their measured scope.
  • concise-code: runtime source +721/-490 across six files, no new production module; six direct internal helper exports and the narrowed graph type each have current callers. Kernel-only vendoring saved 103 Oxc gzip bytes in the engine fixture; moving retained class members accounts for the larger reduction. Replacing object/prototype/lifetime ownership more broadly would change existing identity contracts.

Risk / follow-ups

The measured compiled fixture reduction is below the proposed 5–6 kB target. The complete-bundle Oxc gzip saving is 820 bytes (16,633 to 15,813 bytes, 4.9%); the 4,475-byte figure is uncompressed JavaScript. Ordinary row bundles are byte-identical.

Two upstream recomputation-count expectations already differ on the baseline and remain unchanged. Transferable graph behavior is covered through Octane's public API; Alien's eager-effect API is not emulated. Descriptive and bounded-cycle observations are recorded separately from assertion passes.

Timing trials retain their original fixed baseline; they were not rerun after the upstream integration. The refreshed size builds and focused integration tests cover the current head separately.

Browser intervals remain wide: some primary intervals allow approximately 12% slowdowns, and the order partitions are wider. These measurements do not establish equivalence. Identical-code lifecycle drift remains in the analysis without subtraction. Browser measurements cover synchronous DOM work; layout, paint, physical devices, and cold startup remain unqualified.

The completed browser run retained seven checkpoint-upload aborts, each recovered once outside the measured window without repeating or excluding a sample. Earlier failed and diagnostic runs are preserved separately. Full package/native-DOM publication smokes were not run in the focused benchmark-repair queue. The local release-plan command could not load its cached Changesets dependency after integration; current-head CI passed that check with a frozen installation. The optional initial-document historical report reaches its unchanged lockfile-mismatch guard and is not claimed as a passing report. Local workspace lock generation is blocked by an unrelated managed-registry TypeScript-plugin version; the exact existing Alien 3.2.1 dev importer was edited directly, and final-head frozen installs passed across all 18 dependency-installing CI jobs.

Provenance

  • An agent produced this diff (agent-authored).

Codex task · implementation host: local.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Note

Medium Risk
Changes the core reactive graph implementation and bundle boundaries; behavior is intended to match Alien 3.2.1 but risk concentrates in invalidation, batching, and streaming paths despite expanded tests.

Overview
Octane no longer depends on alien-signals at runtime. The Alien Signals 3.2.1 dependency graph is vendored into graph.ts (with LICENSE attribution), and alien-signals moves to devDependencies for benchmarks and browser tests only.

Internal signal code is refactored for smaller bundles: scope lifecycle, node creation, declaration helpers, read suspend/resume, resource streaming, and facade supersede/__declared logic are lifted out of class methods into module-level functions so unused paths can tree-shake. Benchmarks now default tooling to benchmarks/scoped-signals, pin Alien 3.2.1 for archived comparisons, and assert vendored vs external engine boundaries per manifest.

Coverage: new Vitest suites exercise subscription batching, feedback, and graph edge cases against the inlined engine.

Reviewed by Cursor Bugbot for commit 38adefc. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent perf PR: performance work labels Oct 10, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review October 10, 2026 23:26
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

🟢 No byte growth, no added work, and no timing changes beyond ±3%.

Compares e4d5908db, the merge commit's first parent with d9b832a97 on the same runner. Any increase in a js-framework work counter fails this check; byte changes are a report. Wall time is a report: base and head samples alternate in one browser, and an operation is called slower or faster only when the 95% confidence interval of its ratio excludes ±3%. Workflow run

js-framework: 1k/10k row operations

All 20 timed operations (20 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 2.392 2.500 −0.0% −3.8% … +0.0% ⚪ within noise
octane-tsrx replace 6.033 5.850 ±0.0% −3.8% … +1.7% ⚪ within noise
octane-tsrx add 2.367 2.350 −0.0% −4.1% … +0.0% ⚪ within noise
octane-tsrx update 0.135 0.135 +2.0% −0.5% … +4.5% ⚪ within noise
octane-tsrx select 0.005 0.005 −2.6% −3.0% … −1.5% ⚪ within noise
octane-tsrx swap 0.016 0.017 +1.1% −0.0% … +2.8% ⚪ within noise
octane-tsrx remove 0.014 0.013 −1.0% −2.8% … −0.0% ⚪ within noise
octane-tsrx runlots 23.883 23.367 −1.5% −3.9% … +2.3% ⚪ within noise
octane-tsrx select_lots 0.006 0.006 −1.8% −2.8% … −1.1% ⚪ within noise
octane-tsrx clear 42.292 43.642 +1.0% −0.8% … +3.6% ⚪ within noise
octane-jsx run 3.317 3.358 +2.9% −0.0% … +4.6% ⚪ within noise
octane-jsx replace 6.650 6.608 ±0.0% −3.5% … +3.8% ⚪ within noise
octane-jsx add 3.142 3.167 ±0.0% −1.5% … +3.2% ⚪ within noise
octane-jsx update 0.249 0.254 −0.0% −1.4% … +0.6% ⚪ within noise
octane-jsx select 0.126 0.128 +0.5% ±0.0% … +1.1% ⚪ within noise
octane-jsx swap 0.169 0.170 +1.1% +0.6% … +1.2% ⚪ within noise
octane-jsx remove 0.160 0.163 −0.3% −1.2% … +0.9% ⚪ within noise
octane-jsx runlots 27.042 28.025 +0.6% −1.8% … +3.1% ⚪ within noise
octane-jsx select_lots 1.397 1.401 +0.6% −1.5% … +1.2% ⚪ within noise
octane-jsx clear 45.650 45.400 ±0.0% −2.0% … +1.9% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

No changes across 60 measured values.

Public-import reachability bundles (bytes)

target metric base head Δ
hydrate-frame raw 349,143 346,812 −2,331 (−0.7%) 🟢
hydrate-frame gzip 110,065 109,655 −410 (−0.4%) 🟢
hydrate-frame brotli 94,425 94,064 −361 (−0.4%) 🟢

108 other measured values are unchanged.

@trueadm
trueadm merged commit efe12e3 into octanejs:main Oct 11, 2026
32 checks passed
trueadm added a commit that referenced this pull request Oct 12, 2026
Octane vendored the Alien Signals graph in #1986, so its source no longer
imports alien-signals. The devDependency only fed resolvers that now see
nothing to resolve:

- the native-collection browser test aliased alien-signals for a fixture
  that only imports octane and octane/signals;
- the conversation-streaming and local-void-roots audits recorded its
  version in toolchain provenance (the void-roots audit requires matching
  lockfiles, so its sources are post-vendoring too).

The scheduler backlog scripts accept an archived source checkout, which may
predate vendoring, so they now resolve Alien from benchmarks/scoped-signals,
which owns the comparator dependency since #1986.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent perf PR: performance work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants