[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX] Long loading time
From: |
Tassilo Horn |
Subject: |
Re: [AUCTeX] Long loading time |
Date: |
Thu, 30 Apr 2015 23:43:46 +0200 |
User-agent: |
Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) |
jfbu <address@hidden> writes:
> I did try the profiler as you described to Stefan, but got no results:
> the first method about hitting C-g only ended up in stopping things
> but would not get me into the debugger;
Really strange but I think the second method is more useful anyway.
> the second method gave me a few lists of compiled functions, but
> nothing that I could truly relate to the observed time lag.
Why not? If it's really the kpsewhich calls consuming all the time,
then that buffer should list `TeX-tree-expand' right at the top. Maybe
you have to expand a bit using the + buttons to see it because it is
called by other functions.
> My Mac OS X laptop has a SSD and is a *very fast* operating system.
>
> But I executed with M-: (benchmark-run 50 (TeX-tree-roots))
> and got
>
> (17.778738 0 0.0) with TeXLive 2015
Well, this is pretty slow.
> and ... hold your breath...
>
> (100.477843 1 0.01661499999999999) with TeXLive 2014
And this is almost moving backwards.
> Independently of the Mac OS X problems, there is something
> which is not right in the AUCTeX 11.88 calls to kpsewhich
> and this applies to Linux too
What is not right?
Anyway, I can add some caching so that kpsewhich isn't called more than
once for the same program and variable. Could you (and the others
suffering from this issue) try the following patch and tell if that
helps?
--8<---------------cut here---------------start------------->8---
diff --git a/tex.el b/tex.el
index b7ffc1f..6b55520 100644
--- a/tex.el
+++ b/tex.el
@@ -2347,6 +2347,8 @@ If REGEXP is nil, or \"\", an error will occur."
(setq answers (cons entry answers))))
answers))
+(defvar TeX--kpsewhich-cache nil)
+
(defun TeX-tree-expand (vars program &optional subdirs)
"Return directories corresponding to the kpathsea variables VARS.
This is done calling `kpsewhich --expand-path' for each variable.
@@ -2359,14 +2361,20 @@ trees. Only existing directories are returned."
(let (path-list path exit-status input-dir-list)
(condition-case nil
(dolist (var vars)
- (setq path (with-output-to-string
- (setq exit-status (call-process
- "kpsewhich" nil
- (list standard-output nil) nil
- "--progname" program
- "--expand-path" var))))
+ (let ((cache-entry (assoc (cons program var) TeX--kpsewhich-cache)))
+ (if cache-entry
+ (setq path (cdr cache-entry)
+ exit-status 0)
+ (setq path (with-output-to-string
+ (setq exit-status (call-process
+ "kpsewhich" nil
+ (list standard-output nil) nil
+ "--progname" program
+ "--expand-path" var))))
+ (setq TeX--kpsewhich-cache (cons (cons (cons program var) path)
+ TeX--kpsewhich-cache))))
(when (zerop exit-status)
- (pushnew path path-list :test #'equal)))
+ (pushnew path path-list :test #'equal)))
(error nil))
(dolist (elt (nreverse path-list))
(let ((separators (if (string-match "^[A-Za-z]:" elt)
@@ -2380,7 +2388,7 @@ trees. Only existing directories are returned."
(dolist (subdir subdirs)
(setq path (file-name-as-directory (concat item subdir)))
(when (file-exists-p path)
- (pushnew path input-dir-list :test #'equal)))
+ (pushnew path input-dir-list :test #'equal)))
(setq path (file-name-as-directory item))
(when (file-exists-p path)
(pushnew path input-dir-list :test #'equal))))))
--8<---------------cut here---------------end--------------->8---
Bye,
Tassilo
- Re: [AUCTeX] Long loading time, (continued)
- Re: [AUCTeX] Long loading time, jfbu, 2015/04/29
- Re: [AUCTeX] Long loading time, jfbu, 2015/04/30
- Re: [AUCTeX] Long loading time, jfbu, 2015/04/30
- Re: [AUCTeX] Long loading time, David Kastrup, 2015/04/30
- Re: [AUCTeX] Long loading time, jfbu, 2015/04/30
- Re: [AUCTeX] Long loading time, David Kastrup, 2015/04/30
- Re: [AUCTeX] Long loading time, jfbu, 2015/04/30
- Re: [AUCTeX] Long loading time, jfbu, 2015/04/30
- Re: [AUCTeX] Long loading time, Tassilo Horn, 2015/04/30
- Re: [AUCTeX] Long loading time, jfbu, 2015/04/30
- Re: [AUCTeX] Long loading time,
Tassilo Horn <=
- Re: [AUCTeX] Long loading time, jfbu, 2015/04/30
- Re: [AUCTeX] Long loading time, Tassilo Horn, 2015/04/30
- Re: [AUCTeX] Long loading time, jfbu, 2015/04/30
Re: [AUCTeX] Long Loading time, Munawar Cheema, 2015/04/30
Re: [AUCTeX] Long loading time, Munawar Cheema, 2015/04/30