⚡ Optimize RemapPanel redundant InputRouter node lookups#124
Conversation
Co-authored-by: niyazmft <9331133+niyazmft@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
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.
Co-authored-by: niyazmft <9331133+niyazmft@users.noreply.github.com>
Co-authored-by: niyazmft <9331133+niyazmft@users.noreply.github.com>
💡 What: Cached the InputRouter node via a new
_get_router()method and a class-level variable_cached_routerinstead of repeatedly looking it up viaget_node_or_nullinside loop-intensive functionsget_action_iconandget_action_text.🎯 Why:
get_action_textandget_action_iconare called frequently (especially duringcreate_action_listinitialization 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