perf(clean): replace file-based mdfind cache with in-memory lookups (#986)
The orphan scan forked grep twice per candidate to check the mdfind cache file. On machines with 200+ items in ~/Library/Caches this added 400+ subprocess forks purely for cache hits. Replace the temp-file cache with newline-delimited bash variables checked via case glob matching (zero forks, bash 3.2 compatible). Unify three separate caches into one shared store so bundle IDs resolved during orphan scanning are not re-queried during system service or container stub scanning. Add caching to _container_stub_app_exists which previously had none. Isolated benchmark: ~15x faster cache lookups (539ms → 33ms for 200 bundle IDs). End-to-end mo clean impact is marginal (~1% of total runtime) since mdfind queries and filesystem traversal dominate.
S
Seba Breguel committed
48df35762c6c1f02a5491f48bdcd0bbd9b61c0d3
Parent: b6062cd
Committed by GitHub <noreply@github.com>
on 5/28/2026, 1:44:54 AM