From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: A significant slowdown calling font-lock-fontify-buffer from a hook Date: Tue, 16 Jul 2013 21:01:20 +0300 Message-ID: <83ip0a2xlb.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1373997690 13014 80.91.229.3 (16 Jul 2013 18:01:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Jul 2013 18:01:30 +0000 (UTC) Cc: emacs-devel@gnu.org To: Juanma Barranquero Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 16 20:01:29 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Uz9Z2-00038b-Qk for ged-emacs-devel@m.gmane.org; Tue, 16 Jul 2013 20:01:28 +0200 Original-Received: from localhost ([::1]:46493 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uz9Z2-0003Fy-F7 for ged-emacs-devel@m.gmane.org; Tue, 16 Jul 2013 14:01:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uz9Yv-0003En-27 for emacs-devel@gnu.org; Tue, 16 Jul 2013 14:01:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uz9Yr-0005m2-Qb for emacs-devel@gnu.org; Tue, 16 Jul 2013 14:01:20 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:45176) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uz9Yr-0005kx-GR for emacs-devel@gnu.org; Tue, 16 Jul 2013 14:01:17 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MQ100400JDL8D00@a-mtaout23.012.net.il> for emacs-devel@gnu.org; Tue, 16 Jul 2013 21:01:16 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MQ10047BJE36P40@a-mtaout23.012.net.il>; Tue, 16 Jul 2013 21:01:16 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.175 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:161938 Archived-At: > From: Juanma Barranquero > 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?