From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Scrolling xdisp.c. Room for optimisation in syntax.c/CC Mode. Date: Sat, 18 Oct 2014 20:28:39 +0000 Message-ID: <20141018202839.GB5924@acm.acm> References: <20141018181937.GA5924@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1413664499 5104 80.91.229.3 (18 Oct 2014 20:34:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 Oct 2014 20:34:59 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 18 22:34:52 2014 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 1Xfai9-0002EQ-SH for ged-emacs-devel@m.gmane.org; Sat, 18 Oct 2014 22:34:49 +0200 Original-Received: from localhost ([::1]:37731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xfai9-0002uy-G2 for ged-emacs-devel@m.gmane.org; Sat, 18 Oct 2014 16:34:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xfahp-0002u0-3U for emacs-devel@gnu.org; Sat, 18 Oct 2014 16:34:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xfahh-00057t-J5 for emacs-devel@gnu.org; Sat, 18 Oct 2014 16:34:29 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:10036 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xfahh-000577-9A for emacs-devel@gnu.org; Sat, 18 Oct 2014 16:34:21 -0400 Original-Received: (qmail 91182 invoked by uid 3782); 18 Oct 2014 20:34:19 -0000 Original-Received: from acm.muc.de (pD95182DA.dip0.t-ipconnect.de [217.81.130.218]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 18 Oct 2014 22:34:18 +0200 Original-Received: (qmail 6796 invoked by uid 1000); 18 Oct 2014 20:28:39 -0000 Content-Disposition: inline In-Reply-To: <20141018181937.GA5924@acm.acm> User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 193.149.48.1 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:175540 Archived-At: On Sat, Oct 18, 2014 at 06:19:38PM +0000, Alan Mackenzie wrote: > Hi, Emacs. > I've measured the time Emacs takes to scroll a large C file, and how much > of this is due to the inefficiency in backwards `scan-lists's when > comments contain unbalanced string characters (with > open-paren-in-column-0-is-defun-start nil). [ ... ] > On my set up, a Linux virtual terminal with a window 65 lines high, I get > the following results: > no-odd-xdisp.c: 492 scrolls, total time = 42.2749125957489s > xdisp.c: 492 scrolls, total time = 69.40998315811157s. > 69.4100 / 42.2749 = 1.642. The original thus takes 64% longer (on > average) for a backward scroll operation. I forgot to mention that this was on Emacs 24.3, with full .emacs loaded, and with an up-to-date stand-alone CC Mode. > It would seem worthwhile to consider optimising the code to eliminate > this 64%. Two possibilities suggest themselves: (i) in syntax.c, by > making use of the syntax-ppss cache (or similar); (ii) In CC Mode, by > setting syntax-table text properties on unbalanced string quotes. I've just repeated the measurement on the Emacs trunk, with emacs -Q. I now get these results: no-odd-xdisp.c: 500 scrolls, total time = 104.21487808227539s. xdisp.c: 500 scrolls, total time = 167.73530864715576s. I don't know why there are more scroll operations needed. But the fact that scrolling is taking two and a half times longer in the trunk than in 24..3 is noteworthy, and possibly disturbing. I'm think I compiled both version with the same optimisation level, etc. > -- > Alan Mackenzie (Nuremberg, Germany).