all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Zhiwei Chen <chenzhiwei03@kuaishou.com>
To: "44210@debbugs.gnu.org" <44210@debbugs.gnu.org>
Cc: "condy0919@gmail.com" <condy0919@gmail.com>,
	Dmitry Gutov <dgutov@yandex.ru>
Subject: bug#44210: 28.0.50; project.el failed to work after customizing find-program to fd
Date: Sun, 10 Jan 2021 03:37:18 +0000	[thread overview]
Message-ID: <7AE961A3-205F-4CC4-9634-2D981FF470CC@kuaishou.com> (raw)
In-Reply-To: <5FB48AB0-62C1-48BB-A196-A72DFACE2CA0@kuaishou.com>

[-- Attachment #1: Type: text/plain, Size: 2133 bytes --]

+myself

--
Zhiwei Chen


On Jan 10, 2021, at 11:31 AM, Zhiwei Chen <chenzhiwei03@kuaishou.com<mailto:chenzhiwei03@kuaishou.com>> wrote:

Sorry for late reply, here are the benchmark stats.

The result is promising, ‘fd’ is 3x faster than ‘find’.

(benchmark 5 '(project--files-in-directory "~/Workspace/llvm-project" '(".git")))
;;=> "Elapsed time: 9.401258s (0.097027s in 1 GCs)"

(benchmark 5 '(project--files-in-directory-fd "~/Workspace/llvm-project" '(".git")))
;;=> "Elapsed time: 2.759160s (0.105133s in 1 GCs)”

Where `project--files-in-directory’ is the original version in project.el, and `project--files-in-directory-fd’ modified from the previous one for ‘fd’ use.

The definition of `project--files-in-directory-fd’ follows:

(defun project--files-in-directory-fd (dir ignores &optional files)
  (require 'find-dired)
  (require 'xref)
  (defvar find-name-arg)
  (let* ((default-directory dir)
         ;; Make sure ~/ etc. in local directory name is
         ;; expanded and not left for the shell command
         ;; to interpret.
         (localdir (file-local-name (expand-file-name dir)))
         (command (format "%s . %s %s --type f %s --print0"
                          "fd"
                          ;; In case DIR is a symlink.
                          (file-name-as-directory localdir)
                          ""
                          (if files
                              (concat (shell-quote-argument "(")
                                      " " find-name-arg " "
                                      (mapconcat
                                       #'shell-quote-argument
                                       (split-string files)
                                       (concat " -o " find-name-arg " "))
                                      " "
                                      (shell-quote-argument ")"))
                            ""))))
    (message command)
    (project--remote-file-names
     (sort (split-string (shell-command-to-string command) "\0" t)
           #'string<))))

--
Zhiwei Chen




[-- Attachment #2: Type: text/html, Size: 6813 bytes --]

  reply	other threads:[~2021-01-10  3:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-25 11:26 bug#44210: 28.0.50; project.el failed to work after customizing find-program to fd Zhiwei Chen
2020-10-26 22:37 ` Dmitry Gutov
2021-01-10  3:31 ` Zhiwei Chen
2021-01-10  3:37   ` Zhiwei Chen [this message]
2021-01-10 17:48     ` Dmitry Gutov
2021-01-18  1:15       ` Zhiwei Chen
2021-01-18  3:09         ` Dmitry Gutov
2021-01-11 13:04 ` Zhiwei Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7AE961A3-205F-4CC4-9634-2D981FF470CC@kuaishou.com \
    --to=chenzhiwei03@kuaishou.com \
    --cc=44210@debbugs.gnu.org \
    --cc=condy0919@gmail.com \
    --cc=dgutov@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.