Skip to content

⚡ Bolt: optimize updatestatus string comparisons - #19

Open
CasperGamingOne wants to merge 1 commit into
my_dwmfrom
perf-optimize-updatestatus-16812060065440285856
Open

⚡ Bolt: optimize updatestatus string comparisons#19
CasperGamingOne wants to merge 1 commit into
my_dwmfrom
perf-optimize-updatestatus-16812060065440285856

Conversation

@CasperGamingOne

Copy link
Copy Markdown
Owner

💡 What: Added an early return in updatestatus() within dwm.c if the status text string hasn't changed.

🎯 Why: Previously, updatestatus() was unconditionally calculating the string width using TEXTW() (an O(N) font measurement operation over the text) and redrawing the entire bar via drawbar(), 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

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>
@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.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added the stale label Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant