perf: Hash Grid Broadphase + Hot Path Allocation Reduction (#3071) master
This PR explores a different data structure for handling large numbers of colliders in the scene at a time efficiently. * New features - Query colliders directly on the `PhysicsWorld` ```typescript const scene = ...; const colliders = scene.physics.query(ex.BoundingBox.fromDimensions(...)); ``` * New `SparseHashGrid` data structure - Used as the new default for the collision broadphase which is faster performing than the dynamic try - Used in the `PointerSystem` to improve pointer dispatch when there are a lot of entities * More allocation reduction - New pool type `RentalPool` - `Transform` refactoring to remove - `AffineMatrix` - Graphics context state/Transform stack hot path allocations pooling * Perf improvements to `CircleCollider` bounds calculations * Switch from iterators to c-style loops which bring more speed - `Entity` component iteration - `EntityManager` iteration - `EventEmitter`s - `GraphicsSystem` entity iteration - `PointerSystem` entity iteration