unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* A significant slowdown calling font-lock-fontify-buffer from a hook
@ 2013-07-16  0:12 Juanma Barranquero
  2013-07-16 18:01 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Juanma Barranquero @ 2013-07-16  0:12 UTC (permalink / raw)
  To: Emacs developers

I discovered this because I call colum-marker-1 (from
colum-marker-mode, http://www.emacswiki.org/emacs/column-marker.el) in
the prog-mode-hook, but the issue is with font-lock-fontify-buffer.

emacs -Q --eval "(add-hook 'prog-mode-hook
#'font-lock-fontify-buffer)" src/xdisp.c -f kill-emacs

On Emacs 24.3, -O0 -g3 --enable-checking: about 2 seconds.
On trunk, -O2 -g3 --enable-checking: ~ 33 seconds, x16 slowdown.

Any idea what could be causing this?

    J



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A significant slowdown calling font-lock-fontify-buffer from a hook
  2013-07-16  0:12 A significant slowdown calling font-lock-fontify-buffer from a hook Juanma Barranquero
@ 2013-07-16 18:01 ` Eli Zaretskii
  2013-07-16 18:26   ` Juanma Barranquero
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2013-07-16 18:01 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: emacs-devel

> From: Juanma Barranquero <lekktu@gmail.com>
> Date: Tue, 16 Jul 2013 02:12:40 +0200
> 
> I discovered this because I call colum-marker-1 (from
> colum-marker-mode, http://www.emacswiki.org/emacs/column-marker.el) in
> the prog-mode-hook, but the issue is with font-lock-fontify-buffer.
> 
> emacs -Q --eval "(add-hook 'prog-mode-hook
> #'font-lock-fontify-buffer)" src/xdisp.c -f kill-emacs
> 
> On Emacs 24.3, -O0 -g3 --enable-checking: about 2 seconds.
> On trunk, -O2 -g3 --enable-checking: ~ 33 seconds, x16 slowdown.
> 
> Any idea what could be causing this?

Is the "calling from a hook" an important part of this issue?  If so,
why?

I tried this:

  emacs -Q
  M-x global-font-lock-mode RET
  C-x C-f src/xdisp.c RET
  M-: (font-lock-fontify-buffer) RET

Is this a valid way of reproducing the slowdown?  If so, modify the
last command to start the profiler before invoking
font-lock-fontify-buffer and stop it after it returns, and you will
see that the current trunk calls a certain bunch of functions at least
five-fold more times than Emacs 24.3.  Could that be the reason?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A significant slowdown calling font-lock-fontify-buffer from a hook
  2013-07-16 18:01 ` Eli Zaretskii
@ 2013-07-16 18:26   ` Juanma Barranquero
  2013-07-16 18:47     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Juanma Barranquero @ 2013-07-16 18:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Emacs developers

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

> If so, why?

If you ask, why fails from the hook? I don't know. If the question is,
why do I run font-lock-fontify-buffer from a hook? I don't, but I run
column-marker-1 (from column-marker.el) which calls
font-lock-fontify-buffer.

> Is this a valid way of reproducing the slowdown?

No. If it were, you would notice it. I noticed it because suddenly
loading big source code files was so slow I initially though Emacs was
hung up.

> the current trunk calls a certain bunch of functions at least
> five-fold more times than Emacs 24.3.  Could that be the reason?

Perhaps. I'll look into it.

Thanks,

   Juanma



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A significant slowdown calling font-lock-fontify-buffer from a hook
  2013-07-16 18:26   ` Juanma Barranquero
@ 2013-07-16 18:47     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2013-07-16 18:47 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: emacs-devel

> From: Juanma Barranquero <lekktu@gmail.com>
> Date: Tue, 16 Jul 2013 20:26:56 +0200
> Cc: Emacs developers <emacs-devel@gnu.org>
> 
> > 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 ;-)




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-07-16 18:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-16  0:12 A significant slowdown calling font-lock-fontify-buffer from a hook Juanma Barranquero
2013-07-16 18:01 ` Eli Zaretskii
2013-07-16 18:26   ` Juanma Barranquero
2013-07-16 18:47     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

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