[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/relint 4fcc322 16/21: Delay call to file-relative-name
From: |
Mattias Engdegård |
Subject: |
[elpa] externals/relint 4fcc322 16/21: Delay call to file-relative-name until needed |
Date: |
Sun, 3 May 2020 11:13:38 -0400 (EDT) |
branch: externals/relint
commit 4fcc3220975815471242dff222d9316d58920c53
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>
Delay call to file-relative-name until needed
ENCODE_FILE and DECODE_FILE, present in many file and filename
manipulation primitives, are quite expensive and allocate a lot, even
when names are pure ASCII.
We don't actually need to call file-relative-name until there is a
diagnostic emitted for that file, so evaluate it lazily.
This should really be fixed in Emacs, but meanwhile this mitigation
doesn't hurt.
---
relint.el | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/relint.el b/relint.el
index 1adcaee..e2eefcf 100644
--- a/relint.el
+++ b/relint.el
@@ -91,6 +91,7 @@
(require 'xr)
(require 'compile)
(require 'cl-lib)
+(require 'thunk)
(defvar relint--error-buffer)
(defvar relint--quiet)
@@ -263,7 +264,8 @@ or nil if no position could be determined."
(error-pos (and str-idx (relint--string-pos expr-pos str-idx))))
(if (relint--suppression expr-pos message)
(setq relint--suppression-count (1+ relint--suppression-count))
- (funcall relint--report-function file expr-pos error-pos message
+ (funcall relint--report-function
+ (thunk-force file) expr-pos error-pos message
str str-idx severity)))
(setq relint--error-count (1+ relint--error-count)))
@@ -2191,8 +2193,11 @@ Return a list of (FORM . STARTING-POSITION)."
(with-temp-buffer
(emacs-lisp-mode)
(insert-file-contents file)
- (relint--scan-current-buffer (file-relative-name file base-dir))))
-
+ ;; Call file-relative-name lazily -- it is surprisingly expensive
+ ;; on macOS, and the result only used for diagnostics output.
+ (relint--scan-current-buffer
+ (thunk-delay (file-relative-name file base-dir)))))
+
(defvar relint-last-target nil
"The last file, directory or buffer on which relint was run.")
- [elpa] externals/relint b694c09 07/21: Check split ASCII-raw ranges in rx correctly, (continued)
- [elpa] externals/relint b694c09 07/21: Check split ASCII-raw ranges in rx correctly, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 12a2b0f 08/21: Use regexp in suppression comments, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 9259a5c 03/21: Check some :value parameters in defcustom :type clauses, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint ac75b62 04/21: Check rx-to-string, and the 'regexp' and 'eval' subforms, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 09ef3df 05/21: Describe the new xr wrapped subsumption warning, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint eb178d5 06/21: Check assignments to imenu-generic-expression, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 2eba4d7 09/21: Describe new bol/eol/eos warnings, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint cf2a2ae 14/21: Do file-specific checks on arguments to known functions, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint f6d0fed 15/21: Describe the new file-specific warnings, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 1bf7f25 13/21: Check auto-mode-alist with file-specific checks, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 4fcc322 16/21: Delay call to file-relative-name until needed,
Mattias Engdegård <=
- [elpa] externals/relint 326cfe2 11/21: Check calls to directory-files(-and-attributes), Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 5d3f78d 19/21: Update xr messages ("repetition" changed to "option"), Mattias Engdegård, 2020/05/03
- [elpa] externals/relint a50ed0b 20/21: Don't escape printable chars in rx warnings, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint cdd65ae 10/21: Add section about how relint works, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 636e172 12/21: Add filename-specific checks (unused so far), Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 008fad0 17/21: Repair relint-current-buffer after thunking file parameter, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 8f49686 18/21: Move file-specific checks to xr, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint a001a05 21/21: Increment version to 1.16, Mattias Engdegård, 2020/05/03