Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: Hash Grid Broadphase + Allocation Reduction #3071

Merged
merged 45 commits into from
Jun 29, 2024

Conversation

eonarheim
Copy link
Member

@eonarheim eonarheim commented May 24, 2024

===:clipboard: PR Checklist :clipboard:===

  • 📌 issue exists in github for these changes
  • 🔬 existing tests still pass
  • 🙈 code conforms to the style guide
  • 📐 new tests written and passing / old tests updated with new scenario(s)
  • 📄 changelog entry added (or not needed)

==================

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
      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
    • EventEmitters
    • GraphicsSystem entity iteration
    • PointerSystem entity iteration

Copy link

cloudflare-workers-and-pages bot commented May 24, 2024

Deploying excaliburjs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8de93ce
Status: ✅  Deploy successful!
Preview URL: https://316cee6d.excaliburjs.pages.dev
Branch Preview URL: https://perf-collision-broadphase.excaliburjs.pages.dev

View logs

@eonarheim eonarheim merged commit 6db28e1 into main Jun 29, 2024
6 of 8 checks passed
@eonarheim eonarheim deleted the perf/collision-broadphase branch June 29, 2024 00:55
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