Subject: Fwd: A significant slowdown calling font-lock-fontify-buffer from a hook

From: Juanma Barranquero <[email-masked]>
Date: Wed, 17 Jul 2013 01:03:32 +0200

Package: emacs
Version: 24.3.50
X-Debbugs-Cc: [email-masked]

Filed.

---------- Forwarded message ----------
From: Eli Zaretskii <[email-masked]>
Date: Tue, Jul 16, 2013 at 8:47 PM
Subject: Re: A significant slowdown calling font-lock-fontify-buffer from a hook
To: Juanma Barranquero <[email-masked]>
Cc: [email-masked]

> From: Juanma Barranquero <[email-masked]>
> Date: Tue, 16 Jul 2013 20:26:56 +0200
> Cc: Emacs developers <[email-masked]>
>
> > Is the "calling from a hook" an important part of this issue?
>
> Doing
>
>   emacs -Q src/xdisp.c
>   M-x font-lock-fontify-buffer <RET>
>
> I don't see the slowdown.

First, you need to turn off global-font-lock-mode before visiting
xdisp.c.  Second, if you do turn off global-font-lock-mode, invoking
font-lock-fontify-buffer will fail in Emacs 24.3.  You need to do
something like this instead:

  M-: (let ((c-standard-font-lock-fontify-region-function
'font-lock-default-fontify-region)) (font-lock-fontify-buffer)) RET

If I do this in Emacs 24.3 and in the current trunk, I do see a
significant slowdown: it takes 18 sec with 24.3, and 72 sec with the
current trunk.

So I think the invocation from hook is not a factor here, which is a
Good Thing, because debugging this will be much simpler ;-)