emacs-devel
[Top][All Lists]
Advanced

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

Re: Performance degradation from long lines


From: Alexander Shukaev
Subject: Re: Performance degradation from long lines
Date: Fri, 26 Oct 2018 18:50:06 +0200

On 10/26/18 6:18 PM, Stefan Monnier wrote:
           (let ((inhibit-field-text-motion t))
             (catch 'break
               (while (not (eobp))
                 (when (> (- (line-end-position 1) (point))
                          global-longlines-threshold)
                   (throw 'break t))
                 (forward-line 1)))))))))

I think you can speed this up with the code below (I'd expect a speed up
of about a factor 2 since (line-end-position 1) does about the same as
(forward-line 1)):

     (catch 'break
       (while
           (unless (eobp)
             (or (> (+ (point) global-longlines-threshold)
                       (progn (forward-line 1) (point)))
                 (throw 'break t)))))

Thanks for the tip!


(defun inhibit-set-auto-mode-line-number-display-limit-function ()
   (and (integerp line-number-display-limit)
        (> (buffer-size) line-number-display-limit)))
(add-hook 'inhibit-set-auto-mode-functions
           #'inhibit-set-auto-mode-line-number-display-limit-function)

Hmm... there seems to be a discrepancy between the identifier and the
code: it seems unrelated to line-number(s).  Maybe some left-over from
a previous version of the code?


         Stefan



You are right, sorry about `line-number-display-limit', it should of course be something more reasonable, e.g. (8 * 1024 * 1024) for 8GiG cap.



reply via email to

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