[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/etags-regen a9969d0 2/2: etags-regen--update-file: Speed up dram

From: Dmitry Gutov
Subject: scratch/etags-regen a9969d0 2/2: etags-regen--update-file: Speed up dramatically
Date: Tue, 12 Jan 2021 19:42:55 -0500 (EST)

branch: scratch/etags-regen
commit a9969d0e57cf520dd9093d4146db69cae55a9a44
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    etags-regen--update-file: Speed up dramatically
    ^ turned out to be a very expensive anchor.  It was the difference
    between a "real" regexp search and a literal search, and the latter's
    much faster.  And since we're searching literally, might as well use
 lisp/progmodes/etags-regen.el | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/lisp/progmodes/etags-regen.el b/lisp/progmodes/etags-regen.el
index b77169f..188ea72 100644
--- a/lisp/progmodes/etags-regen.el
+++ b/lisp/progmodes/etags-regen.el
@@ -178,16 +178,12 @@ File extensions to generate the tags for."
           (setq should-scan t))
          ((progn (set-buffer tags-file-buf)
                  (goto-char (point-min))
-                 ;; FIXME: With a big enough TAGS, even this can be
-                 ;; slow (and, unfortunately, synchronous).  Using the
-                 ;; project-relative name here speeds it up, but only
-                 ;; by ~30%.  Some indexing could help.
-                 (re-search-forward (format "^%s," (regexp-quote file-name)) 
nil t))
-          (let ((start (line-beginning-position)))
-            (re-search-forward "\f\n" nil 'move)
+                 (search-forward (format "\f\n%s," file-name) nil t))
+          (let ((start (match-beginning 0)))
+            (search-forward "\f\n" nil 'move)
             (let ((inhibit-read-only t)
                   (save-silently t))
-              (delete-region (- start 2)
+              (delete-region start
                              (if (eobp)
                                (- (point) 2)))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]