From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Low redisplay performance (23 regression) Date: Wed, 29 Apr 2009 16:20:49 -0400 Message-ID: References: <4870CC42-A08E-4BE9-B566-0F4DA7AB0B74@gmail.com> <878wlj228q.fsf@freebits.de> <87skjrz7k7.fsf@freebits.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1241036495 19719 80.91.229.12 (29 Apr 2009 20:21:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Apr 2009 20:21:35 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Tobias C. Rittweiler" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 29 22:21:26 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LzGHW-0007nU-3d for ged-emacs-devel@m.gmane.org; Wed, 29 Apr 2009 22:21:26 +0200 Original-Received: from localhost ([127.0.0.1]:41743 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LzGHV-0006zo-Db for ged-emacs-devel@m.gmane.org; Wed, 29 Apr 2009 16:21:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LzGHQ-0006zJ-W9 for emacs-devel@gnu.org; Wed, 29 Apr 2009 16:21:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LzGHM-0006wO-G0 for emacs-devel@gnu.org; Wed, 29 Apr 2009 16:21:20 -0400 Original-Received: from [199.232.76.173] (port=42407 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LzGHM-0006wJ-A0 for emacs-devel@gnu.org; Wed, 29 Apr 2009 16:21:16 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:47972) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LzGHL-00083k-Vq for emacs-devel@gnu.org; Wed, 29 Apr 2009 16:21:16 -0400 Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id n3TKKp45024697; Wed, 29 Apr 2009 16:20:51 -0400 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id BC21A3A96D; Wed, 29 Apr 2009 16:20:49 -0400 (EDT) In-Reply-To: <87skjrz7k7.fsf@freebits.de> (Tobias C. Rittweiler's message of "Wed, 29 Apr 2009 19:35:52 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3264=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:110558 Archived-At: >> > As I use `end-of-defun' in my customized >> > `font-lock-extend-region-functions' this does have an impact on the >> > overall performance of fontification for me on large files. >> I don't think the size of the file (aka buffer) should make >> a difference. > Yes, I meant to write on large defuns. I test this on a file which > contains defuns spanning up to 500-600 lines. Yes, that makes sense. > I'm not sure how much you can do with this information. But I can concur > with the OP that there does seem to be a performance regression. Indeed font-lock-fontify-keywords-region (which is the part which I'd expect to take the bulk of the time and would be a source of performance problems no matter how you implement your font-lock-extend-region-functions if you force refontification of the whole defun every time), so as I was saying font-lock-fontify-keywords-region got about twice as slow. And I can't explain it. As far as I know, this part of font-lock has not been changed in any significant way. What happens if you use Emacs-22's font-lock.el in Emacs-23? > > So it's about twice as slow for this test, which is the expected in this > > case: since your benchmark always calls it with point between 2 defuns, > > it ends up doing: BOD-raw to find the previous defun, EOD-function to > > find its end, which tells Emacs that the starting point was after the > > previous defun, so it calls BOD-raw again to find the next defun and > > finally EOD-function to get to its end. > Why didn't 22.x do this? Probably to fix some bug, right? No, you're right. Emacs-22's code is very different, but it should end up doing pretty much the same thing (two calls to BOD-raw plus two calls to forward-list) and I see no reason why it should be any faster. Stefan