SIGN IN SIGN UP
tw93 / Mole UNCLAIMED

🐹 Deep clean and optimize your Mac.

0 0 83 Shell

perf(clean): skip per-item protection checks in Darwin runtime cleanup

mo clean spent ~30s walking ~1500 items under DARWIN_USER_TEMP_DIR and
DARWIN_USER_CACHE_DIR, with most of the wall time in per-item
should_protect_path / is_path_whitelisted subshells. The directory
itself has already been vetted by _darwin_user_runtime_dir_is_safe
(parent must be one of the two getconf'd Darwin user runtime dirs,
owned by the current UID), find narrows to -user "$current_uid"
-mtime +N, state files (sqlite/db/plist) are excluded by both name
filter and case guard, and safe_remove still routes through
validate_path_for_deletion.

Drop the per-item checks. Local measurement on a 20k-item TMPDIR:

  before: 75s wall, 19s user CPU
  after:  59s wall, 7.8s user CPU (~58% less user time, 21% less wall)

No behavior change for the explicit safety contract; only the redundant
in-loop validation is gone.
T
Tw93 committed
8c940f708115599111c2e56a9e75e58c7b0fa71c
Parent: 5cb15c0