feat: round-robin work packaging and scheduler optimizations

Merged
TH
3mo ago
+1846-239
  • 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.