Skip to content

feat: round-robin work packaging and scheduler optimizations - #50

Merged
thygrrr merged 3 commits into
mainfrom
perf/core-hot-paths
Aug 5, 2026
Merged

thygrrr merged 3 commits into
mainfrom
perf/core-hot-paths

Conversation

@thygrrr

@thygrrr thygrrr commented Aug 5, 2026 •

Copy link
Copy Markdown
Collaborator
  • Add direct storage binding for concrete stream expressions while preserving wildcard joins.
  • Cap fragmented Stream.Job scheduling to reduce work items and allocations.
  • Reduce filtered-job allocations and remove rejected-entity no-op dispatch.
  • Preserve exception behavior across segmented workers.
  • Add focused benchmarks and regression tests.

In the 1,024-archetype benchmark, no-op Job improved from 514 µs/12.9 KB/1,024 work items to 107 µs/800 B/23 work items. All 4,289 tests pass.


Summary by cubic

Round-robin work packaging with a worker-aware cap cuts over-scheduling on fragmented archetypes and speeds up hot-path dispatch. Concrete streams and joins bind directly to storage, and segmented worker faults now flatten and rethrow while letting other segments finish.

  • Performance

    • Added round-robin segment packaging with a Concurrency-based cap to limit work items on fragmented archetypes.
    • Bound concrete stream expressions and Cross.Join directly to storage; wildcard joins remain for Match.Any.
    • Removed excluded-branch scheduling in FilteredStream.Job and trimmed pooled-job allocations.
    • Benchmarks added for stream binding, For/Job crossover, and filtered dispatch. No-op job (1,024 archetypes): 514 µs / 12.9 KB / 1,024 items → 107 µs / 800 B / 23 items.
  • Bug Fixes

    • Flattened and rethrown worker exceptions across segments; other segments continue after a fault, with new regression tests.
    • Direct joins hold no pooled state; dispose is safe and does not touch pooled resources.

Written for commit 70816fd. Summary will update on new commits.

Review in cubic

@cubic-dev-ai

cubic-dev-ai Bot commented Aug 5, 2026

Copy link
Copy Markdown

We've triggered an ultrareview automatically — This PR rewrites core job scheduling and work packaging with concurrency batching, direct storage binding, and segmented exception propagation—a missed bug could cause data corruption, deadlocks, or incorrect exception behavior across the entire ECS runtime.. I'll post findings when complete.

An ultrareview is cubic's deepest review, catching hard-to-find bugs in the most critical PRs. It runs a longer, multi-pass analysis using cubic's most capable review models, and typically takes around 30 minutes. It consumes your team's reviewed-lines allowance at 3× the standard rate.

Automated ultrareviews are disabled by default. We triggered this run as part of your trial. Want cubic to do this for every high-risk PR? Enable auto-ultrareview in your settings.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultrareview completed in 11m 31s

All reported issues were addressed across 13 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

@thygrrr
thygrrr merged commit f74122f into main Aug 5, 2026
2 checks passed
@thygrrr
thygrrr deleted the perf/core-hot-paths branch August 5, 2026 10:37
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