-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Passes stage argument to avoid unnecessary stage retrieval calls
#4322
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
Conversation
…to feautre/xform-view
Greptile SummaryThis PR implements a performance optimization by passing the Key Changes:
The changes follow a consistent pattern: functions that previously called Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User as User Code
participant Scene as InteractiveScene
participant Camera as Camera Sensor
participant XformView as XformPrimView
participant Spawner as Spawner Functions
participant USD as USD Context
participant Stage as USD Stage
Note over User,Stage: Before: Multiple get_current_stage() calls
User->>Scene: Initialize scene
Scene->>USD: get_current_stage()
USD-->>Scene: stage
Scene->>Camera: Initialize camera
Camera->>USD: get_current_stage()
USD-->>Camera: stage
Camera->>XformView: XFormPrim(path)
XformView->>USD: get_current_stage()
USD-->>XformView: stage
Note over User,Stage: After: Stage passed explicitly
User->>Scene: Initialize scene
Scene->>USD: get_current_stage() (once)
USD-->>Scene: stage
Scene->>Camera: Initialize camera (stage=stage)
Camera->>XformView: XformPrimView(path, stage=stage)
Note over XformView: Uses passed stage directly
Scene->>Spawner: spawn_shape(cfg, stage=stage)
Spawner->>Stage: bind_material(prim, material, stage=stage)
Note over Spawner,Stage: All operations use cached stage
Note over User,Stage: Performance Benefit: Eliminates redundant USD context calls
|
Description
This MR passes the
stageattribute to the functions where applicable. This helps avoid unnecessaryget_current_stage()calls as that calls the USD context and can be at times expensive. It is a better practice to give the stage as much as possible.Type of change
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there