Skip to content

Reduce Windows CLI idle CPU#3874

Merged
louis030195 merged 1 commit into
mainfrom
codex/optimize-screenpipe-cli-cpu
Jun 9, 2026
Merged

Reduce Windows CLI idle CPU#3874
louis030195 merged 1 commit into
mainfrom
codex/optimize-screenpipe-cli-cpu

Conversation

@louis030195

Copy link
Copy Markdown
Collaborator

Summary

  • skip mDNS advertisement for loopback-only server binds, avoiding unnecessary LAN broadcast work and Windows firewall prompts during local CLI runs
  • make the Windows UIA worker back off while the shared screen-lock flag is set, and clear deferred UIA work while the desktop is inaccessible
  • mark failed/invalid UIA capture attempts as attempted and avoid immediate wakeups when tree capture is disabled

Profiling

Pulled latest main, built target\release\screenpipe.exe, then profiled screenpipe record with audio/telemetry/keyboard/clipboard capture disabled while driving idle, app switching, typing, and scrolling phases.

Average CPU as % of one core:

phase baseline optimized
startup 0.666 0.269
idle_pre 1.877 1.023
app_switch 3.844 1.383
typing 2.482 0.285
scrolling 2.048 0.266
idle_post n/a 0.143

The optimized run reproduced the OpenInputDesktop unavailable screen-lock state that previously caused high idle CPU, and stayed low. It also logged localhost server startup without the previous mdns: advertising line.

Test plan

  • cargo fmt
  • ORT_SKIP_DOWNLOAD=1 cargo test -p screenpipe-engine server::tests::mdns_advertising --lib
  • ORT_SKIP_DOWNLOAD=1 cargo test -p screenpipe-a11y platform::windows_uia::tests::test_screen_lock_pause_clears_deferred_work --lib
  • ORT_SKIP_DOWNLOAD=1 cargo test -p screenpipe-a11y platform::windows_uia::tests::test_compute_next_timeout_ignores_tree_work_when_capture_disabled --lib
  • ORT_SKIP_DOWNLOAD=1 cargo test -p screenpipe-a11y platform::windows_uia::tests::test_tree_hash_stable --lib
  • ORT_SKIP_DOWNLOAD=1 cargo build --release -p screenpipe-engine --bin screenpipe

@louis030195 louis030195 marked this pull request as ready for review June 9, 2026 20:57
@louis030195 louis030195 merged commit 3044b32 into main Jun 9, 2026
22 checks passed
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