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 09:33:12 -0400 Message-ID: References: <4870CC42-A08E-4BE9-B566-0F4DA7AB0B74@gmail.com> <878wlj228q.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 1241012013 7332 80.91.229.12 (29 Apr 2009 13:33:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Apr 2009 13:33:33 +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 15:33:23 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 1Lz9uc-0004SF-GW for ged-emacs-devel@m.gmane.org; Wed, 29 Apr 2009 15:33:22 +0200 Original-Received: from localhost ([127.0.0.1]:47602 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lz9ub-0003NX-Rg for ged-emacs-devel@m.gmane.org; Wed, 29 Apr 2009 09:33:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lz9uY-0003NS-F4 for emacs-devel@gnu.org; Wed, 29 Apr 2009 09:33:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lz9uU-0003N9-2C for emacs-devel@gnu.org; Wed, 29 Apr 2009 09:33:18 -0400 Original-Received: from [199.232.76.173] (port=44391 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lz9uT-0003N6-Rd for emacs-devel@gnu.org; Wed, 29 Apr 2009 09:33:13 -0400 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]:13949 helo=ironport2-out.teksavvy.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lz9uT-0007iO-Ew for emacs-devel@gnu.org; Wed, 29 Apr 2009 09:33:13 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhsFAGT090lMCpT6/2dsb2JhbACBUM4cg3UFhTo X-IronPort-AV: E=Sophos;i="4.40,266,1238990400"; d="scan'208";a="37755897" Original-Received: from 76-10-148-250.dsl.teksavvy.com (HELO ceviche.home) ([76.10.148.250]) by ironport2-out.teksavvy.com with ESMTP; 29 Apr 2009 09:33:12 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 34F10B5227; Wed, 29 Apr 2009 09:33:12 -0400 (EDT) In-Reply-To: <878wlj228q.fsf@freebits.de> (Tobias C. Rittweiler's message of "Wed, 29 Apr 2009 12:17:09 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:110546 Archived-At: > GNU Emacs 22.1.1 --> (4.323907 2 0.07007399999999997) > GNU Emacs 23.0.60.1 --> (7.5862680000000005 1 0.048462000000000005) > GNU Emacs 23.0.92.1 --> (7.610763 2 0.06742599999999999) > (built on 2009-04-29) 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. > 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. And I can't think of a good reason why EOD should take a non-negligible amount of time compared to running font-lock-fontify-region on a whole defun at a time. > What is the reason that `end-of-defun' is an _order of magnitude_ slower > than `beginning-of-defun'? Because EOD uses BOD internally, I guess. Of course in your font-lock-extend-region-functions, you may simply prefer to use BOD rather than EOD. Stefan