⚡ Bolt: optimize updatestatus string comparisons - #19
Conversation
By buffering the new status text and checking if it perfectly matches the existing `stext` via `strcmp`, this optimization avoids expensive `TEXTW` string width calculations and redundant `drawbar()` X11 redrawing calls when the status string has not changed. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@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. |
|
This PR has been inactive for 5 days and has been marked as stale. It will remain open indefinitely, but please provide an update if you intend to continue working on it. |
💡 What: Added an early return in
updatestatus()withindwm.cif the status text string hasn't changed.🎯 Why: Previously,
updatestatus()was unconditionally calculating the string width usingTEXTW()(an O(N) font measurement operation over the text) and redrawing the entire bar viadrawbar(), even if a script fired a fast timer to update a property with an identical string.📊 Impact: Reduces CPU utilization and redundant X11 server load significantly when automated scripts update the root window properties frequently but the data hasn't visually changed (e.g. clock update scripts ticking every 1 second but outputting only minute precision).
🔬 Measurement: Measure the CPU and Xorg process activity when running a script that issues
xsetroot -name "Same String"repeatedly in a while-true loop before and after this change.PR created automatically by Jules for task 16812060065440285856 started by @CasperGamingOne