From d81f404b50380f90f3b7fd8b7ca48e883980650b Mon Sep 17 00:00:00 2001 From: Eric Torres Date: Wed, 23 Mar 2022 17:22:30 -0700 Subject: [PATCH] Run fd on maximum number of threads --- file_scripts/search.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/file_scripts/search.py b/file_scripts/search.py index 024c764..bc0da2d 100644 --- a/file_scripts/search.py +++ b/file_scripts/search.py @@ -7,14 +7,26 @@ import shutil import subprocess +from os import sched_getaffinity from sys import platform +_num_threads = len(sched_getaffinity(0)) # have fd run on multiple threads + # ========== Constants ========== # ----- Commands ----- # Options: show hidden files, null terminator, files only # Optional arguments: show vcs files, show every file FIND_CMD = shutil.which("fd") -DEFAULT_FIND_OPTS = ["--hidden", "--print0", "--type", "f", "--type", "l"] +DEFAULT_FIND_OPTS = [ + "--threads", + _num_threads, + "--hidden", + "--print0", + "--type", + "f", + "--type", + "l", +] EXTRA_FIND_OPTS = {"no_ignore": "--no-ignore", "no_ignore_vcs": "--no-ignore-vcs"} # Options: null terminator, ignore case, print names matching all non-option arguments