Skip to content

⚡ Optimize RemapPanel redundant InputRouter node lookups#124

Merged
niyazmft merged 5 commits into
mainfrom
perf/optimize-remap-panel-lookups-11320102254896643776
Jun 2, 2026
Merged

⚡ Optimize RemapPanel redundant InputRouter node lookups#124
niyazmft merged 5 commits into
mainfrom
perf/optimize-remap-panel-lookups-11320102254896643776

Conversation

@niyazmft
Copy link
Copy Markdown
Owner

@niyazmft niyazmft commented Jun 2, 2026

💡 What: Cached the InputRouter node via a new _get_router() method and a class-level variable _cached_router instead of repeatedly looking it up via get_node_or_null inside loop-intensive functions get_action_icon and get_action_text.
🎯 Why: get_action_text and get_action_icon are called frequently (especially during create_action_list initialization or polling) resulting in unnecessary absolute path tree traversal costs per action in the InputMap.
📊 Measured Improvement: Benchmarked a looping test of 100 fake actions invoking both functions. Baseline execution time was ~1,374,968 us (1.37s). Optimized execution time was ~1,316,907 us (1.31s). This is a measurable ~4.2% overall execution time improvement for this UI polling pattern.


PR created automatically by Jules for task 11320102254896643776 started by @niyazmft

Co-authored-by: niyazmft <9331133+niyazmft@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces caching for the InputRouter node in remap_panel.gd to optimize lookups and adds a benchmark script to measure execution time. The review feedback points out that the lazy-loading implementation will repeatedly perform expensive lookups if the router is null (e.g., in unit tests). To resolve this, the reviewer suggests using an @onready variable to fetch the router once and updating all references to use this cached variable directly.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread scripts/ui/remap_panel.gd
Comment thread scripts/ui/remap_panel.gd
Comment thread scripts/ui/remap_panel.gd
Comment thread scripts/ui/remap_panel.gd
google-labs-jules Bot and others added 3 commits June 2, 2026 21:21
Co-authored-by: niyazmft <9331133+niyazmft@users.noreply.github.com>
Co-authored-by: niyazmft <9331133+niyazmft@users.noreply.github.com>
@niyazmft niyazmft merged commit c816cc8 into main Jun 2, 2026
3 checks passed
@niyazmft niyazmft deleted the perf/optimize-remap-panel-lookups-11320102254896643776 branch June 2, 2026 21:43
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