From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Björn Lindqvist" <bjourne@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Mode-specific font lock delays
Date: Sun, 04 Sep 2016 22:51:30 -0400 [thread overview]
Message-ID: <jwvinubhxuq.fsf-monnier+Inbox@gnu.org> (raw)
In-Reply-To: <CALG+76cFkrv81Y7eYF3J21Q9obwVrsnFnaggu_oc+cQJBsvEAg@mail.gmail.com> ("Björn Lindqvist"'s message of "Sun, 4 Sep 2016 21:12:09 +0200")
> Ah I see. I thought font-lock highlighted the whole buffer when you
> opened a file. That it delays highlighting parts of a buffer until you
> scroll into it, I didn't know. If there was a way to force font-lock
> to highlight the whole buffer I would use that because it doesn't
> matter so much if opening buffers takes 300 ms or so more.
(setq font-lock-support-mode nil)
would do that, pretty much (i.e. would stop use of jit-lock).
>> So far the experience has been that font-lock can be made fast enough
>> that those things aren't needed.
> These are the font-locking rules for the mode I'm working on:
> https://github.com/factor/factor/blob/master/misc/fuel/factor-mode.el#L443
> I'm not able to figure out how to make them faster. But if you or
> anyone else can I'd be happy. :)
I'd recommend you use M-x profiler-start RET and friends to try and
figure out where the problem comes from.
Also I recommend you try and think which part could take time that
depends on the size of the buffer: normally jit-lock will only fontify
the part of the buffer that changed or that is displayed, which does not
depend on the buffer size but rather on the window size. So if you see
a slowdown in large buffers, it means some of the rules you use take
a time that depends on the buffer size.
Normally regexps shouldn't take time that depends on the buffer-size
either (they can take very long for some specific text, but that only
depends on the text being matched, not the total buffer text). So think
of rules which might do more than just match a regexp, and which might
instead look at the surrounding context (e.g. try to find the beginning
of the surrounding function).
Stefan
prev parent reply other threads:[~2016-09-05 2:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-04 5:01 Mode-specific font lock delays Björn Lindqvist
2016-09-04 13:34 ` Stefan Monnier
2016-09-04 19:12 ` Björn Lindqvist
2016-09-05 2:51 ` Stefan Monnier [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvinubhxuq.fsf-monnier+Inbox@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=bjourne@gmail.com \
--cc=help-gnu-emacs@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).