Repository navigation
perf: avoid empty effect argument arrays - #1023
Merged
domgan-oai merged 1 commit intoSep 9, 2026
Merged
Conversation
domgan-oai
marked this pull request as ready for review
September 9, 2026 18:31
Closed
68 of 84 tasks
14 of 21 tasks
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.
Summary
Function.prototype.apply. An undefined argument list already means zero callback arguments, so no temporary empty array is needed.octane.Partially addresses #981's effect-dispatch item. Hook-map membership checks remain necessary for cleared or rolled-back slots; this PR does not change those checks or specialize callback arities.
Performance evidence
Baseline: merged main
9b17f4e2899e1bec886e8577197d40429f006c48. Same Node 26.4.0 / V8 14.6.202.34-node.21, production transform, workload, and observer for both revisions:The guard extracts the actual runtime helper by AST and observes it after production transformation. Clean and observed runs agree on callback arguments/receiver, cleanup, phase/depth restoration, stale-entry rejection, and errors. The zero-array guard fails on the baseline. These are source array-creation events at the helper boundary, not measured heap allocations or application latency: an optimizing engine may already eliminate the temporary array.
Both rebuilt production
effectful-listfixtures (TSRX and TSX) also passed all six existing lifecycle/DOM gates with three iterations. Their explicit dependency arrays are negative controls; no timing improvement is claimed.Validation
pnpm typecheck:files packages/octane/src/runtime.tspnpm format:files:checkfor all six changed files andgit diff --checkpnpm sync(no generated changes)pnpm test,pnpm typecheck, andpnpm format:checkwere not run locally for this bounded runtime change. Current-head CI passed all 26 jobs on9fe7ce2f9198500f4af9d678797b0f0421c5fdad, including lint, typechecking, all runtime and React parity shards, browser integration, package validation, and examples. Cursor Bugbot completed successfully with no findings; there are no review threads to resolve.Risk / follow-ups
The runtime change adds no state, caches, branching, or retained references. Existing slot/publication guards, exception routing, and cleanup handling are unchanged. SSR does not execute effect bodies. Independent diff review found no correctness issues. The remaining effect-dispatch ideas in #981 need separate correctness and performance evidence.
Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Low Risk
Single-line runtime dispatch change with broad new tests and a regression guard; no auth, data, or scheduling logic changes beyond argument passing semantics.
Overview
Effect dispatch no longer allocates a temporary empty array when an effect has no dependency list:
runEffectBodypassese.argsstraight intoapplyinstead of(e.args ?? []), relying onundefinedmeaning zero positional arguments.Adds an untimed allocation guard (
benchmarks/effectful-list/dispatch.mjs) that AST-extracts the productionrunEffectBody, instruments array literals, and asserts zero creations for omitted/empty/value dependency cases (with optional baseline compare). Documents it in the effectful-list README and records an octane patch changeset.Tests add
EffectArgumentsand a matrix over undefined/null/empty and 1–4 deps for insertion, layout, and passive effects—checking nullthis, positional args, cleanup pairing, and re-fire rules (empty[]does not re-run on update).Reviewed by Cursor Bugbot for commit 9fe7ce2. Bugbot is set up for automated code reviews on this repo. Configure here.