[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

extremely slow font-lock-mode

From: Martin Pohlack
Subject: extremely slow font-lock-mode
Date: Tue, 11 Dec 2007 11:25:35 +0100
User-agent: Thunderbird (X11/20071115)


I'm experiencing very slow syntax highlighting with emacs-23.0.60
(GTK+ Version 2.12.1).

Simply scrolling in source files takes incredibly long (~ 1 second for
scolling one line backwards).  This is an a dual-core 2 GHZ machine

I tried to play with all font-lock and jit-lock customization options
but only turning font-lock off seemed to make a difference.

I tried to use elp to instrument relevant packages (mwheel, font-lock,
jit-lock, mouse, lazy-lock, fast-lock).  After some scrolling (~ 20
seconds, with pauses, mouse wheel, pg-keys and scrollbar) I get
the following results:

Function Name                      Call Count  Elapsed Time  Average Time
================================== ==========  ============  ============
mwheel-scroll                      62          4.060767      0.0654962419
jit-lock-function                  18          0.0083890000  0.0004660555
jit-lock-fontify-now               18          0.0082680000  0.0004593333
font-lock-fontify-region           18          0.007176      0.0003986666
font-lock-default-fontify-region   18          0.006962      0.0003867777
font-lock-fontify-syntactically-re 18          0.0042169999  0.0002342777
font-lock-fontify-keywords-region  18          0.0020000000  0.0001111111
jit-lock-context-fontify           21          0.0017679999  8.419...e-05
font-lock-mode                     14          0.0004470000  3.192...e-05
font-lock-unfontify-region         18          0.000194      1.077...e-05
mwheel-filter-click-events         55          0.0001699999  3.090...e-06
font-lock-prepend-text-property    32          0.0001610000  5.031...e-06
mwheel-event-button                62          0.0001379999  2.225...e-06
mwheel-event-window                62          0.0001349999  2.177...e-06
font-lock-default-function         14          0.0001119999  8e-06
mwheel-inhibit-click-timeout       7           0.000105      1.5e-05
font-lock-change-mode              2           9.5e-05       4.75e-05
font-lock-default-unfontify-region 18          6.500...e-05  3.611...e-06
font-lock-extend-region-multiline  18          4.5e-05       2.5e-06
font-lock-extend-region-wholelines 18          4.4e-05       2.444...e-06
font-lock-set-defaults             18          4.200...e-05  2.333...e-06
mouse-region-match                 1           6e-06         6e-06

So, mwheel-scroll seems to behave badly.   However, lots of the
problematic calls also seem to have been lost.  E.g., scrolling with
keyboard was also very slow and is not shown in the table.

I also noticed, that scrolling forward seems to go considerably faster
than scrolling backwards (maybe this has to do with syntax-driven

The results are twofold for me:

First, I don't seem to be using elp right or it is the wrong tool.
Ideally, I would like to use a /sampling/ profiler for emacs.
 - Is there such a thing that can look into running lisp code?
 - How should I be using elp differently for getting meaningful

Second, font-lock-mode is currently unusable for me.  I started emacs
with -q, so I don't think my local tweak are to blame.  emacs-22 on my
local machine is incredibly fast for the same file (also started with
 - What might be to blame here?
 - Do you need more details on any aspect of my machine configuration?

Martin Pohlack

reply via email to

[Prev in Thread] Current Thread [Next in Thread]