Commit Graph

2 Commits

Author SHA1 Message Date
hypercross 339e850e10 perf: optimize iteration and command enqueuing
- Optimize Select2 and Select3 iterators to drive from the smallest
  sparse set to minimize probes.
- Use a constrained generic in CommandQueue.Enqueue to avoid boxing
  struct commands at the call site.
- Ensure singleton infrastructure is initialized during world
  deserialization if the singleton entity is loaded.
- Change EnsureSingleton to internal.
2026-07-18 21:32:29 +08:00
hypercross f1eddc75ae feat: add deferred structural mutations and entity iterators
Implement deferred structural mutations (AddComponent, RemoveComponent,
DestroyEntity) to allow safe modification of the world during
iteration.

Additionally, introduce a new `EntityIterator` API providing zero-
allocation `ref struct` iterators (`Select<T1>`, `Select<T1, T2>`, etc.)
to support manual iteration with early-exit capabilities.

As part of these changes, component access via `GetComponent<T>` during
iteration now automatically marks components as modified.
2026-07-18 21:22:23 +08:00