Repository navigation
perf(octane): register compiler commit writers by cell - #2095
Conversation
Benchmark report🟢 No byte growth, no added work, and no timing changes beyond ±3%. Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)No changes across 93 measured values. Public-import reachability bundles (bytes)No changes across 123 measured values. |
trueadm
left a comment
There was a problem hiding this comment.
Approving. This is compiler bookkeeping only: the compiled output is the same and the work is linear.
Correctness. writes[cell] ??= make keeps first-writer-wins, which the old some(...) check provided. Iterating the sparse array in index order reproduces the old numeric sort without allocating tuples or sorting. The undefined skip in emitCommitFunction handles holes, and writes.length === 0 still means "no writes", since any registered cell makes the length non-zero. Every commit.write call site (compile.js ~31366, ~31434, ~31450) passes a numeric cell index, so no non-index key can silently fall out of the iteration. reset() reassigns writes = [], so the sparse array doesn't leak between templates. Factories are still called lazily with commit.size() at emit time.
One small suggestion, not blocking: a one-line comment on write saying cell must be a non-negative integer index would make that assumption explicit for future callers.
Numbers (benchmark on aa79387, run 38755904889):
- All 64 work counters are unchanged.
- All 93 application and 123 reachability byte values are unchanged, which confirms byte-identical compiled output across the bench corpus. That matches your 54-output check.
- All timings are within noise.
CI on the current head is fully green: 30 pass, 6 skipped matrix placeholders.
Reviewed with Claude Code
Summary
Register commit-writer factories at their compiler-assigned cell index. This removes a linear duplicate search for every writer and the later tuple sort while preserving first-writer wins, numeric cell order, and deferred factory execution.
Validation
pnpm format:check(scoped format check passed)pnpm typecheck(scoped typecheck passed)pnpm test(full workspace suite not run locally)Mapwould preserve insertion order rather than the required numeric cell order. Independent complexity review found no remaining unjustified complexity.Risk / follow-ups
The output-equivalence corpus is representative, not exhaustive; current-head CI supplies broader coverage.
Provenance
agent-authored)Codex task · host
com-79386.Need help on this PR? Tag
@codesmith-botwith what you need.Note
Low Risk
Compiler-only bookkeeping with no runtime output path changes; behavior is intended to stay byte-identical aside from removing O(n) registration work per writer.
Overview
perf(octane): Commit-plan writer registration now stores each factory at its compiler cell index (
writes[cell] ??= make) instead of appending[cell, make]tuples and scanning for duplicates.When emitting the commit function, the compiler walks that structure in index order and invokes factories—dropping the previous sort-by-cell step—while keeping first-writer-wins semantics and deferred
make(commit.size())execution. A patch changeset documents the octane release note.Reviewed by Cursor Bugbot for commit aa79387. Bugbot is set up for automated code reviews on this repo. Configure here.