On 07/17/2013 04:42 AM, Juanma Barranquero wrote: > Could all this be related to Paul's substitution > of many macros by inline functions? Could be. Did the problem start happening with trunk bzr 113359? If so, I would suspect that it's the recent changes to syntax.c. But I'm afraid I don't understand what the problem is. I tried the test case in the bug report: src/emacs -Q --eval "(add-hook 'prog-mode-hook #'font-lock-fontify-buffer)" src/xdisp.c -f kill-emacs I'm running Fedora 17 x86-64 with GCC 4.8.1. On Emacs 24.3 (configured with --enable-profiling, but compiled with the default -O2 optimization) this takes 1.1 s (user + system CPU time). In the current trunk (bzr 113441) it takes 50.1 s. The difference is so large that there must be something else going on. Looking at the gprof outputs (attached) it appears that 24.3 is invoking scan_sexps_forward only 1628 times, whereas the current trunk is invoking it 400829 times. So I assume that most of the performance difference is something at the Lisp level. Or perhaps I'm just not running the correct test case?