Skip to content

Commit

Permalink
perf: move find -type after -name
Browse files Browse the repository at this point in the history
GNU `find`(1) says “The `-name` test comes before the `-type` test in
order to avoid having to call `stat`(2) on every file.”
https://git.sv.gnu.org/cgit/findutils.git/commit/find/find.1?id=06887a6b8e

Signed-off-by: Lucas Larson <[email protected]>
  • Loading branch information
LucasLarson committed Apr 24, 2024
1 parent 3157a87 commit 4fb8c3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -242,21 +242,20 @@ command -p -- test -w '/etc/motd' &&

# delete thumbnail cache files
command -p -- find -- . \
-type f \
'(' \
-name '.DS_Store' -o \
-name 'Desktop.ini' -o \
-name 'Thumbs.db' -o \
-name 'desktop.ini' -o \
-name 'thumbs.db' \
')' \
-type f \
-delete

# delete empty files
# except those within `.git/` directories
# and those with specific names
command -p -- find -- . \
-type f \
-size 0 \
-path "${DOTFILES-}"'/Library' -prune -o \
-path "${HOME%/}"'/Library' -prune -o \
Expand All @@ -282,6 +281,7 @@ command -p -- find -- . \
! -name '.well-known' \
! -name '__init__.py' \
! -name 'favicon.*' \
-type f \
-delete

# if the shell can be changed and
Expand Down

0 comments on commit 4fb8c3f

Please sign in to comment.