all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ryan B <public@ryanb.org>
To: emacs-devel@gnu.org
Subject: Re: Making font-lock handle long lines better
Date: Sun, 13 May 2018 12:44:09 -0700	[thread overview]
Message-ID: <CA+caGh8DpwKKn3xMQFE+pqbHOVjWPf=Oc1ZJ5x==wCzEts28Aw@mail.gmail.com> (raw)
In-Reply-To: <CABr8ebY_0sUTmv_unYQSdZ4VjrCf3KNH3nnE2SW_sd-xEdU9+A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1980 bytes --]

for the record, i narrowed this down to the maven element of
`compilation-error-regexp-alist'. if i remove that element,
`compilation-mode' is fast on the minimal test case in
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25682 .

it's evidently a somewhat known issue:
https://blog.danielgempesaw.com/post/129841682030/fixing-a-laggy-compilation-buffer
https://www.reddit.com/r/emacs/comments/2b2j5m/emacs_unresponsive_during_compilebuild/
http://comments.gmane.org/gmane.emacs.bugs/28783  (currently down)


On Sat, Feb 11, 2017 at 3:09 PM Anders Lindgren <andlind@gmail.com> wrote:

> Since it's slow in Fundamental mode as well, it's unrelated to
>> font-lock, and thus to this thread.  Display of very long lines is
>> known to be slow in Emacs.
>>
>
> I believe this is a font-lock problem. If you disable
> global-font-lock-mode before you open the file, it opens in seconds. If
> global-font-lock-mode is active Emacs stops responding (I gave up after a
> few minutes).
>
> A quick experiment suggested that the problem is the member
> `font-lock-extend-region-wholelines' of `font-lock-extend-region-functions'
> that ensures that whenever font-lock highlights keywords in a region, the
> full line is rehighlighted (in the case of the example, the full 18M). By
> removing it, font-locking the file is done in seconds. (I assume that only
> the visible parts of the buffer is highlighted.)
>
> Clearly, simple dropping the function is not a good idea, as keyword
> fontification could start anywhere on the line, e.g. in the middle of
> identifiers. A better approach would be to extend the region to include
> 10KB in either direction, plus ensure that the region isn't split in the
> middle of identifiers.
>
>    / Anders
>
> Ps. In case anybody is interested in looking further into this, you can
> use the tool https://github.com/Lindydancer/highlight-refontification to
> get visual feedback on the font-lock refontification process.
>
>

-- 
https://snarfed.org/

[-- Attachment #2: Type: text/html, Size: 3164 bytes --]

  reply	other threads:[~2018-05-13 19:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-10 15:44 Making font-lock handle long lines better Ryan B
2017-02-10 15:57 ` joakim
2017-02-10 16:24 ` Eli Zaretskii
2017-02-11 20:10   ` Wilfred Hughes
2017-02-11 20:28     ` Eli Zaretskii
2017-02-11 23:06       ` Anders Lindgren
2018-05-13 19:44         ` Ryan B [this message]
2018-05-15  0:05           ` Noam Postavsky
2018-05-15  8:08             ` Jostein Kjønigsen
2018-05-15 16:50               ` Eli Zaretskii
2018-05-15 18:32                 ` Stefan Monnier
2017-02-11 22:06 ` Ryan B

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+caGh8DpwKKn3xMQFE+pqbHOVjWPf=Oc1ZJ5x==wCzEts28Aw@mail.gmail.com' \
    --to=public@ryanb.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.