mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 21:20:09 +00:00
perf(purge/uninstall): eliminate per-item subprocess forks in scan phase
purge:
- is_safe_project_artifact: replace echo|tr|wc depth calc with pure bash
string arithmetic (2 forks → 0 per item)
- process_scan_results: replace dirname subprocess with ${item%/*}
- is_recently_modified: accept pre-computed epoch to avoid redundant
get_epoch_seconds call (N date forks → 1 before loop)
- fd pattern construction: replace 45 per-target sed forks with single
printf|sed pass (45 forks → 2)
- pre-compute _cached_project_paths alongside existing name/basename
cache so display loop avoids get_project_path subshell per item
uninstall/app-selector:
- default size display: N/A → -- for apps without cached size data
(cleaner UX on first scan; real sizes populate from background refresh)
- Pass 1 scan: replace basename/dirname subshells with parameter expansion
This commit is contained in:
@@ -17,8 +17,8 @@ format_app_display() {
|
||||
fi
|
||||
|
||||
# Format size
|
||||
local size_str="N/A"
|
||||
[[ "$size" != "0" && "$size" != "" && "$size" != "Unknown" ]] && size_str="$size"
|
||||
local size_str="--"
|
||||
[[ "$size" != "0" && "$size" != "" && "$size" != "Unknown" && "$size" != "N/A" && "$size" != "--" ]] && size_str="$size"
|
||||
|
||||
# Calculate available width for app name based on terminal width
|
||||
# Accept pre-calculated max_name_width (5th param) to avoid recalculation in loops
|
||||
|
||||
Reference in New Issue
Block a user