Columns/Main/Meters panels: move const calc expression out of loop#2042
Columns/Main/Meters panels: move const calc expression out of loop#2042GermanAizek wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis change applies a micro-optimization across ColumnsPanel.c, MainPanel.c, and MetersPanel.c by caching the results of Panel_size(super) or Vector_size(meters) into local const int variables before entering for loops, rather than re-evaluating these functions on each loop iteration. The affected functions are ColumnsPanel_cancelMoving, MainPanel_idSearch, MainPanel_foreachRow, MetersPanel_setMoving, and MetersPanel_new. No control flow, logic, or public API declarations are altered. Changes
Related issues: None specified. Related PRs: None specified. Suggested labels: performance, refactor Suggested reviewers: htop-dev maintainers familiar with Panel/MetersPanel internals Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The core team consensus is to leave such optimizations to the compiler for better readability of the code to humans. Closing. |
Reference: #2038