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: Stefan Monnier
Subject: Re: Performance degradation from long lines
Date: Fri, 26 Oct 2018 12:18:52 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>           (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)))))

> (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




reply via email to

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