Subject: bug#20404: 25.0.50; Sometimes no fontification with jit-lock-defer-time

From: Stefan Monnier <[email-masked]>
Date: Wed, 22 Apr 2015 13:37:13 -0400

[ OFFTOPIC: the bug report is not about performance but about
  a functional bug in jit-lock-defer.  ]

> There's a solution (or, depending on your point of view, a workaround)
> for this.  You're using Emacs-25, so set fast-but-imprecise-scrolling to
> t, or customize it (it's in customisation group "scrolling").

FWIW, on my machine, this doesn't make much difference: a single
"font-lock one screen's worth" takes much too long, so after that one
screen is displayed, Emacs takes a while catching up (with no display at
all in the mean time).

That's why after you installed your change, I installed the one I had
suggested (which tweaks the decision about when to skip redisplay and
when to defer font-lock and relies on using jit-lock-defer-time).
In my tests, it worked significantly better (was able to keep up).

So I recommend you try jit-lock-defer-time set to 0 instead of using
fast-but-imprecise-scrolling, and see if you like the
resulting behavior.

IIUC if Emacs can *almost* keep up, then fast-but-imprecise-scrolling
might be just enough to let it keep up, in which case the behavior may
look be better than with jit-lock-defer-time (because the text is never
displayed unfontified). But if the repeat rate is faster than that, then
jit-lock-defer-time should give noticeably better results.

        Stefan