Performance: Spatial collision checking, shapely caching, ...#6
Merged
lbergmann1 merged 17 commits intoMay 5, 2026
Merged
Conversation
Cache the object's base polygon and goal polygon during episode reset to avoid rebuilding them on every step.
Add spatial hashing for collision detection and precompute wall-segment lookup table. Refactor qpos_is_valid to use precomputed wall data and optimize fast paths for uniform mover sizes and complete tile layouts.
lbergmann1
reviewed
Apr 30, 2026
Member
lbergmann1
left a comment
There was a problem hiding this comment.
Great work! I just found some minor things. Please correct them and merge the current main branch. I will then update the version and the changelog and merge the changes into the main branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Speeds up four hot paths with no interface changes.
qpos_is_valid: Replaces per-step tile broadcast with a pre-computed wall-segment lookup table. Intersection tests are now vectorized.O(n^2)all-pairs mover collision check with a tile spatial grid. The new complexity should beO(n * k), wherekis the average number of movers in a shared "tile neighbourhood"scipyrotation matrix in favour of inline 2D trig.