Skip to content

perf: adaptive frame budget, O(n) descendant iteration, leaner signal dispatch - #7

Merged
renderffx merged 5 commits into
mainfrom
perf/peak-core-optimizations
Aug 7, 2026
Merged

perf: adaptive frame budget, O(n) descendant iteration, leaner signal dispatch#7
renderffx merged 5 commits into
mainfrom
perf/peak-core-optimizations

Conversation

@renderffx

Copy link
Copy Markdown
Owner
  • Frame scheduler: budget now adapts to the measured inter-frame interval instead of a fixed 240fps floor. On 60Hz panels this stops spurious degradation and false dropped-frame counts.
  • ECS: forEachDescendant rewritten from quadratic sibling scans to an O(n) iterative preorder DFS on a shared typed-array stack.
  • Signal dispatch: removed a redundant per-subscriber bounds check in the fan-out loops; deduped world fetch in layout-rect accessors.
  • Bench: restored missing benchScale/reportScale/scale-sweep types that broke the tsc build of the bench entry points.

Verified

  • tsc --noEmit -p packages/core passes
  • bench/targeted-benchmarks.test.ts — 18/18 pass

- physics.zig: fix @Splat syntax, @ptrCast alignment, @vecCmp -> vecCmpLt/vecCmpGt, @max -> vecSelect, var->const
- main.ts: color LUT, 4x unroll, precomputed hues, reuse ImageData
- vite.config.ts: COOP/COEP headers for SharedArrayBuffer
- vite-plugin.ts: fix WASM build path resolution
- physics.zig: Zig 0.14.1 compat (@Splat, @aligncast, vecCmpLt/Gt, vecSelect, const correctness)
- main.ts: color LUT (360 hues), 4x unroll, precomputed golden-angle hues, zero-alloc ImageData
- vite.config.ts: COOP/COEP headers for SharedArrayBuffer
- vite-plugin.ts: WASM build path fix (__dirname -> ../../src/zig)

- frame-scheduler.ts: stage error boundary (setStageErrorHandler), try/catch per group
- codegen.ts: suppressDestructuring option for state.methodName() syntax
- signal.ts: (check diff)
- scene-editor/vite.config.ts: COOP/COEP headers
- hpc-demo: new package with 5k entity ECS demo (white bg, old-school)
- package.json/pnpm-lock.yaml: deps
- scripts/compile.ts: (check diff)
@renderffx
renderffx merged commit d31adba into main Aug 7, 2026
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