Skip to content

topbar, rs-launcher: eliminate Start menu search stutter and reduce CPU/RAM/GDI overhead - #334

Open
2sulraw wants to merge 1 commit into
Lemxy:mainfrom
2sulraw:perf/start-menu-and-topbar
Open

2sulraw wants to merge 1 commit into
Lemxy:mainfrom
2sulraw:perf/start-menu-and-topbar

Conversation

@2sulraw

@2sulraw 2sulraw commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Eliminate Start menu open & search stutter (plugins/topbar/src/fly.rs, plugins/topbar/src/main.rs):
    • Move .lnk / Shell icon extraction (IShellLinkW / IShellItemImageFactory) off the UI thread (WM_PAINT) onto a single persistent COM background worker (icon_worker + coalesced WM_APP_ICON), pre-warming the first 10 visible icons during startup load_apps(), and bounding the icon cache to 256 entries.
    • Precompute lowercase names, word initials, and store-app flags in AppEntry; replace lip_layout per-call Vec allocations with static [char; 33] tables; lock USAGE once per query; and cache filtered results in FILTER_CACHE.
    • Replace per-keystroke
      s.is_file() + hread::spawn in ind_loose_exes with a single persistent Condvar-debounced (150 ms) worker and prune stale loose .exe entries on new queries.
    • Throttle load_apps() to at most once every 60 s and disable the 1 s WM_TIMER on Kind::Start / Kind::Menu.
  • Reduce GDI/RAM churn & background CPU ( ly.rs, main.rs, second.rs,
    s-launcher.rs)
    :
    • Cache flyout fonts (7 HFONTs), FLY_BG backdrop, and reuse offscreen backbuffers (FLY_BUF, BAR_BUF, SEC_BUF, PAINT_BUF), freeing flyout/launcher buffers when closed/hidden.
    • Short-circuit collect() (EnumWindows) on cheap checks (visibility, owner, tool window, title length, class name on stack [u16; 32]) before calling DwmGetWindowAttribute.
    • Deduplicate exe_of() / win_meta() calls in
      efresh_buttons(), extend META cache TTL to 30 s once an icon is resolved, and raise
      epaint_if_changed idle safety-net interval to 60 s.

Verification

  • cargo test -p topbar: 31 passed, 1 failed (wmi::tests::reads_live_wmi in sandboxed environment; all ly::tests::*, taskbar, and secondary-bar tests pass).
  • cargo build -p topbar --release and cargo build --manifest-path plugins/rust-search/Cargo.toml --bin rs-launcher --release succeed with 0 errors.

…PU/RAM/GDI overhead

# Conflicts:
#	plugins/topbar/src/fly.rs
@2sulraw
2sulraw force-pushed the perf/start-menu-and-topbar branch from e93712b to afbd5ce Compare December 3, 2026 20:05
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