Skip to content

Cache lowercase aliases for action/plugin matching#885

Merged
multiplex55 merged 1 commit intomasterfrom
codex/extend-alias-loading-and-optimize-cache-usage
Feb 17, 2026
Merged

Cache lowercase aliases for action/plugin matching#885
multiplex55 merged 1 commit intomasterfrom
codex/extend-alias-loading-and-optimize-cache-usage

Conversation

@multiplex55
Copy link
Copy Markdown
Owner

Motivation

  • Reduce per-search heap allocations and repeated to_lowercase() calls by caching lowercase alias strings for folders and bookmarks.
  • Keep UI search results correct immediately after alias file changes by rebuilding both original and lowercase alias maps on watch events.

Description

  • Added parallel lowercase alias maps folder_aliases_lc and bookmark_aliases_lc to LauncherApp and helper builders folder_alias_maps() / bookmark_alias_maps() to load both original and pre-lowercased alias values in one pass.
  • Introduced normalize_alias() and alias_matches_lc() helpers to centralize alias normalization and case-insensitive matching logic used by search paths.
  • Updated initialization in new() to populate both alias maps and updated process_watch_events() to refresh both maps on WatchEvent::Folders and WatchEvent::Bookmarks, calling search() after refresh to update visible results.
  • Reworked search_actions() and search_plugins() to use the cached lowercase alias maps via alias_matches_lc() instead of calling to_lowercase() inside tight loops, while continuing to use the existing action_cache for lowercase label/desc checks.
  • Added unit tests that assert (1) action search remains case-insensitive when using cached lowercase aliases and (2) watch events refresh both original and lowercase alias caches for folders and bookmarks. (Tests are in src/gui/mod.rs.)

Testing

  • Ran cargo fmt --all which completed successfully.
  • Attempted cargo test for the added unit(s), but the build failed in this environment during dependency compilation due to a missing system library required by alsa-sys (pkg-config/alsa.pc not available), so the new tests could not be executed here.
  • Verified code changes and new tests were added and cargo fmt applied; the search behavior and alias-refresh logic are covered by the new unit tests for environments where system build deps are present.

Codex Task

@multiplex55 multiplex55 merged commit 79be111 into master Feb 17, 2026
1 check passed
@multiplex55 multiplex55 deleted the codex/extend-alias-loading-and-optimize-cache-usage branch February 20, 2026 14:48
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