unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Martin Pohlack <mp26@os.inf.tu-dresden.de>
To: emacs-devel@gnu.org
Subject: extremely slow font-lock-mode
Date: Tue, 11 Dec 2007 11:25:35 +0100	[thread overview]
Message-ID: <475E659F.4000303@os.inf.tu-dresden.de> (raw)

Hi,

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
jit-lock?).

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
   results?

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
-q).
 - What might be to blame here?
 - Do you need more details on any aspect of my machine configuration?

Cheers,
Martin Pohlack

             reply	other threads:[~2007-12-11 10:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-11 10:25 Martin Pohlack [this message]
2007-12-11 22:32 ` extremely slow font-lock-mode martin rudalics
2007-12-12  0:21   ` Martin Pohlack
2007-12-12  4:25     ` Kenichi Handa
2007-12-12  8:22       ` Martin Pohlack
2007-12-12 11:06         ` Kenichi Handa
2007-12-12  8:37 ` Richard Stallman

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=475E659F.4000303@os.inf.tu-dresden.de \
    --to=mp26@os.inf.tu-dresden.de \
    --cc=emacs-devel@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.
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).