Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 29, 2025

Description

Identifies and fixes slow/inefficient code patterns across the codebase.

Fixes:

  • Duplicate function definitions (quat_from_euler_xyz, save_json, postprocess_small_regions)
  • Broken deprecation warnings calling non-existent omni.log.warn → proper warnings.warn()
  • rigid_body_twist_transform using deprecated quat_rotate_inverse → faster quat_apply_inverse

Optimizations:

  • _sqrt_positive_part: indexed assignment → vectorized torch.where
  • select_grasp, _generate_cache, _load_cache, get_dis_arr: loop-based array filling → np.array() + list comprehension
  • differential_solver.get_ik: removed unnecessary deepcopy(), computed torch.inverse() once instead of twice
  • remove_overlap_mask: pre-compute areas as numpy array

Example fix:

# Before (broken)
omni.log.warn("deprecated...")  # omni not imported

# After
warnings.warn("deprecated...", DeprecationWarning, stacklevel=2)

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Screenshots

N/A

Checklist

  • I have run the black . command to format the code base.
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • Dependencies have been updated, if applicable.
Original prompt

Identify and suggest improvements to slow or inefficient code


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Identify and suggest improvements to inefficient code Fix performance issues: remove duplicates, fix broken deprecation warnings, optimize loops Nov 29, 2025
Copilot AI requested a review from yuecideng November 29, 2025 14:53
@yuecideng yuecideng marked this pull request as ready for review December 3, 2025 16:07
@yuecideng yuecideng merged commit 3800e83 into main Dec 3, 2025
4 checks passed
@yuecideng yuecideng deleted the copilot/improve-slow-code-efficiency branch December 3, 2025 16:07
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