Skip to content

Performance: Spatial collision checking, shapely caching, ...#6

Merged
lbergmann1 merged 17 commits into
ubi-coro:mainfrom
cedricgrothues:performance-optimization
May 5, 2026
Merged

Performance: Spatial collision checking, shapely caching, ...#6
lbergmann1 merged 17 commits into
ubi-coro:mainfrom
cedricgrothues:performance-optimization

Conversation

@cedricgrothues
Copy link
Copy Markdown
Contributor

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.
  • Replaces O(n^2) all-pairs mover collision check with a tile spatial grid. The new complexity should be O(n * k), where k is the average number of movers in a shared "tile neighbourhood"
  • Caches the object polygon and goal polygon in the pushing environments. They are now built once per episode reset instead of every step. HER is unaffected as object geometry can still be passed via the info dictionary.
  • Drops the scipy rotation matrix in favour of inline 2D trig.

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 lbergmann1 self-requested a review April 30, 2026 08:44
Copy link
Copy Markdown
Member

@lbergmann1 lbergmann1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread magbotsim/basic_magbot_env.py Outdated
Comment thread magbotsim/basic_magbot_env.py Outdated
Comment thread magbotsim/basic_magbot_env.py Outdated
Comment thread magbotsim/basic_magbot_env.py Outdated
Comment thread magbotsim/basic_magbot_env.py Outdated
@lbergmann1 lbergmann1 merged commit 8ffa035 into ubi-coro:main May 5, 2026
4 of 5 checks passed
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.

2 participants