[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gtags-mode 1f2f3d272b 57/61: Fix performance issue.
From: |
ELPA Syncer |
Subject: |
[elpa] externals/gtags-mode 1f2f3d272b 57/61: Fix performance issue. |
Date: |
Thu, 28 Apr 2022 10:57:42 -0400 (EDT) |
branch: externals/gtags-mode
commit 1f2f3d272b6e73e3541acf6c4c5ee2a8f2cab52a
Author: Jimmy Aguilar Mena <kratsbinovish@gmail.com>
Commit: Jimmy Aguilar Mena <kratsbinovish@gmail.com>
Fix performance issue.
file-true-name is too expensive. It was consuming 98% of the time in a
find-reference with tramp.
---
gtags-mode.el | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/gtags-mode.el b/gtags-mode.el
index 8d137c1454..ed66559ab6 100644
--- a/gtags-mode.el
+++ b/gtags-mode.el
@@ -65,7 +65,7 @@ The address is absolute for remote hosts.")
"Regex to filter the output with `gtags-mode--output-format-options'.")
(defconst gtags-mode--output-format-options
- '("--result=ctags-x" "--path-style=absolute --color=never")
+ '("--result=ctags-x" "--path-style=absolute" "--color=never")
"Command line options to use with `gtags-mode--output-format-regex'.")
;; Connection functions
@@ -157,20 +157,19 @@ On success return a list of strings or nil if any error
occurred."
nil))
;; Utilities functions (a bit less low level) ========================
-(defun gtags-mode--get-plist (directory)
+(defun gtags-mode--get-plist (dir)
"Return the plist for DIRECTORY from `gtags-mode--alist'."
- (let ((truename (file-truename directory)))
- (catch 'found
- (dolist (plist gtags-mode--alist)
- (when (string-prefix-p (plist-get plist :gtagsroot) truename)
- (throw 'found plist)))
- nil)))
-
-(defun gtags-mode--create-plist (directory)
+ (catch 'found
+ (dolist (plist gtags-mode--alist)
+ (when (string-prefix-p (plist-get plist :gtagsroot) dir)
+ (throw 'found plist)))
+ nil))
+
+(defun gtags-mode--create-plist (dir)
"Return dbpath for DIRECTORY or nil if none."
- (when-let* ((default-directory (file-truename directory))
+ (when-let* ((default-directory dir)
(root (car (gtags-mode--exec-sync '("--print-dbpath")))))
- (setq root (file-truename (concat (file-remote-p default-directory) root)))
+ (setq root (concat (file-remote-p default-directory) root))
(or (gtags-mode--get-plist root) ;; already exist
(car (push `(:gtagsroot ,root :cache nil) gtags-mode--alist)))))
@@ -252,8 +251,7 @@ Return as a list of xref location objects."
(gtags-mode--filter-find-symbol
args symbol
(lambda (_name code file line)
- (xref-make code (xref-make-file-location
- (file-truename (concat remote file)) line 0))))))
+ (xref-make code (xref-make-file-location (concat remote file) line
0))))))
(cl-defmethod xref-backend-identifier-completion-table ((_backend (head
:gtagsroot)))
"List all symbols."
@@ -287,7 +285,7 @@ Return as a list of xref location objects."
;; project integration ===============================================
(defun gtags-mode-project-backend (dir)
"Return the project for DIR as an array."
- (gtags-mode--get-plist dir))
+ (gtags-mode--get-plist (file-truename dir)))
(cl-defmethod project-root ((project (head :gtagsroot)))
"Root for PROJECT."
@@ -299,13 +297,11 @@ Return as a list of xref location objects."
(remote (file-remote-p root))
(results (mapcan
(lambda (dir)
- (when-let* ((tdir (file-truename dir))
- ((string-prefix-p root tdir)))
- (mapcar (lambda (file)
- (concat remote file)) ;; Add remote prefix
+ (when (string-prefix-p root dir)
+ (mapcar (lambda (file) (concat remote file)) ;; Add
remote prefix
(gtags-mode--exec-sync
'("--path-style=absolute" "--path")
- (string-remove-prefix root tdir)))))
+ (string-remove-prefix root dir)))))
(or dirs `(,root)))))
(if (> (length dirs) 1) (delete-dups results) results)))
- [elpa] externals/gtags-mode a2c84b5a2b 28/61: Optimize avoiding with-current-buffer., (continued)
- [elpa] externals/gtags-mode a2c84b5a2b 28/61: Optimize avoiding with-current-buffer., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 076ae4a55e 51/61: Fall back to default on imenu., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode c60bb82307 42/61: Don't use with-memoization it is too new., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 54368ee7e0 38/61: Better use of the new plist., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 053184f8b5 14/61: Don't call with-connection-local-variables, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 192258fa32 17/61: Use list instead of quotes., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 9fc5c618a1 36/61: Simplify a bit more the cache handling code., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode c823dcffc9 49/61: Assert not call plist-put for nil, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode d4890f5bb3 45/61: Small simplification., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 95b730930b 27/61: Remove global-xref--sync-sentinel, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 1f2f3d272b 57/61: Fix performance issue.,
ELPA Syncer <=
- [elpa] externals/gtags-mode 9dcb18fbe7 58/61: Use cscope output; it is easier to parse., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 0954a065d3 37/61: Miscellaneous fixes, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode a14940cd98 35/61: Reorder some code and simplify cache code, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode e8d19c4333 52/61: Add code to run extra sentinel, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 9c4323a5e6 13/61: Improve connection local code., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode a9f6acbaba 22/61: List GTAGS buffers., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 04c2d9fbaf 24/61: Use file-truename, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 599dfb8002 18/61: Improve debug of async processes., ELPA Syncer, 2022/04/28