martin rudalics wrote: >> I'm experiencing very slow syntax highlighting with emacs-23.0.60 >> (GTK+ Version 2.12.1)a. >> >> 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: > > I suppose you did not turn on lazy-lock or fast-lock, hence these two > are hardly relevant here. No, I did it just for completeness reasons. [...] >> I also noticed, that scrolling forward seems to go considerably faster >> than scrolling backwards (maybe this has to do with syntax-driven >> jit-lock?). > > Usually it's slower only if you scroll back into _not yet fontified_ > areas. That is what I thought too, but I scrolled through the whole file several times before that. Maybe caching the font properties is broken? >> The results are twofold for me: >> >> First, I don't seem to be using elp right or it is the wrong tool. > > You did use it right but it's probably not the right tool for finding > the cause of the problem. Ok, I tried some oprofiling, which of course can only catch native functions. The result is still interesting: $ opreport -l image:/usr/bin/emacs-23-unicode Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit \ mask of 0x00 (Unhalted core cycles) count 240000 samples % symbol name 48798 32.2244 lookup_char_property 37434 24.7200 next_interval 24605 16.2482 get_property_and_range 12083 7.9792 previous_interval 10370 6.8480 Fcdr 9619 6.3520 Fcar 6904 4.5591 textget 355 0.2344 assq_no_quit 170 0.1123 find_interval ... >> 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? > > First of all we have to find out whether this is mode specific. > Often a badly constructed regexp can cause such problems. Did you > try with different major modes? Probably not. I see this in tex, c++, c, diff, asm, and text mode. Basically everywhere with larger files. File size seems to matter, also direction of scrolling and position in the file. Also cursor placement using the mouse (no scrolling involved, just clicking somewhere in the visible buffer area) incurs large delays (~ 1 second). > Next you should try if it's buffer specific. I have many source-code files here, which behave similar. I attached two. > Can you post the file showing the bug (maybe it's only a small part of > the file that exhibits the problem). Seems to be everywhere in the files. > >> - Do you need more details on any aspect of my machine configuration? > > Please send these details just as if you reported a bug. I also tried with the current CVS version for the same branch and built it myself with similar results. The output below is from calling report-emacs-bug in the buffer of one such problematic file. In GNU Emacs 23.0.60.1 (i686-pc-linux-gnu, GTK+ Version 2.12.1) of 2007-12-11 on monat Windowing system distributor `The X.Org Foundation', version 11.0.10300000 configured using `configure '--prefix=/usr' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--program-suffix=-emacs-23-unicode' '--infodir=/usr/share/info/emacs-23-unicode' '--without-carbon' '--with-sound' '--with-x' '--with-toolkit-scroll-bars' '--enable-font-backend' '--with-freetype' '--with-xft' '--with-jpeg' '--with-tiff' '--with-gif' '--with-png' '--with-xpm' '--with-rsvg' '--with-x-toolkit=gtk' '--without-hesiod' '--with-kerberos' '--with-kerberos5' '--without-gpm' '--build=i686-pc-linux-gnu' 'build_alias=i686-pc-linux-gnu' 'host_alias=i686-pc-linux-gnu' 'CFLAGS=-march=prescott -pipe -O2'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: POSIX value of $LC_CTYPE: de_DE.UTF-8 value of $LC_MESSAGES: en_US.UTF-8 value of $LC_MONETARY: de_DE.UTF-8 value of $LC_NUMERIC: nil value of $LC_TIME: de_DE.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default-enable-multibyte-characters: t Major mode: C/l Minor modes in effect: shell-dirtrack-mode: t flyspell-mode: t desktop-save-mode: t pc-selection+-mode: t show-paren-mode: t pc-selection-mode: t mouse-sel-mode: t tooltip-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t global-auto-composition-mode: t auto-composition-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t abbrev-mode: t