From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#8890: 23.3; message writing slows emacs Date: Fri, 16 Sep 2011 11:54:28 +0300 Message-ID: <83litovpdn.fsf@gnu.org> References: <83fwk3xe8v.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1316163336 6717 80.91.229.12 (16 Sep 2011 08:55:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 16 Sep 2011 08:55:36 +0000 (UTC) Cc: larsi@gnus.org, 8890@debbugs.gnu.org To: Dave Abrahams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 16 10:55:32 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R4UCp-0001ZS-Dr for geb-bug-gnu-emacs@m.gmane.org; Fri, 16 Sep 2011 10:55:31 +0200 Original-Received: from localhost ([::1]:36985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4UCo-0004a2-Vs for geb-bug-gnu-emacs@m.gmane.org; Fri, 16 Sep 2011 04:55:30 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:49611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4UCi-0004Zs-VG for bug-gnu-emacs@gnu.org; Fri, 16 Sep 2011 04:55:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R4UCf-0002fJ-4H for bug-gnu-emacs@gnu.org; Fri, 16 Sep 2011 04:55:24 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4UCf-0002f6-2Z for bug-gnu-emacs@gnu.org; Fri, 16 Sep 2011 04:55:21 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1R4UHD-0008NB-BD; Fri, 16 Sep 2011 05:00:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Sep 2011 09:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8890 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8890-submit@debbugs.gnu.org id=B8890.131616356132098 (code B ref 8890); Fri, 16 Sep 2011 09:00:02 +0000 Original-Received: (at 8890) by debbugs.gnu.org; 16 Sep 2011 08:59:21 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R4UGX-0008Lf-Bs for submit@debbugs.gnu.org; Fri, 16 Sep 2011 04:59:21 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R4UGU-0008LV-GG for 8890@debbugs.gnu.org; Fri, 16 Sep 2011 04:59:19 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LRL00500XZX2E00@a-mtaout20.012.net.il> for 8890@debbugs.gnu.org; Fri, 16 Sep 2011 11:54:26 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([77.126.9.62]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LRL0048QY2PH890@a-mtaout20.012.net.il>; Fri, 16 Sep 2011 11:54:26 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 16 Sep 2011 05:00:03 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:51216 Archived-At: > From: Dave Abrahams > Cc: Lars Magne Ingebrigtsen , 8890@debbugs.gnu.org > Date: Sun, 11 Sep 2011 12:39:23 -0400 > > >> Emacs does clever screen updates, though. So if the only thing that > >> changes is the number before the percentage, Emacs won't repaint the > >> entire line, I think? > > > > True. Like I said, redisplay of the echo area is very fast. > > I don't think it's clever enough. Try this: > > --8<---------------cut here---------------start------------->8--- > (let (timings) > (dolist (reps '(1 10)) > (let ((start-time (current-time))) > (loop for x to 10000 do > (loop repeat reps do > (message "message #%s" x))) > (push (time-subtract (current-time) start-time) timings))) > (message "%s" (mapcar 'time-to-seconds timings))) > --8<---------------cut here---------------end--------------->8--- > > I get (29.539774 2.514761) > > I think this shows that it takes (more than) 10x as long to write out > the same message 10 times as it does to write it out once. My results are different: . in a GUI session: (16.172 2.891) . in a -nw (TTY) session: (26.125 4.734) The above is from an unoptimized build. Here are timings from an optimized build: . GUI session: (10.875 2.0) . TTY: (19.313 3.453) This shows that it takes 45% _less_ time to write the same message 10 times than 10x time to write the message once. So at best the numbers are inconclusive. Anyway, I know for a fact that Emacs does optimize screen writes in this case. Look at the function dispnew.c:update_text_area, around lines 3784 to 3967. I actually put a breakpoint there and saw that only the changing number is being redrawn while running your test code. E.g., on line 3885, I see i = 9 while stop = 11, which means Emacs will redraw only 2 characters.