unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Dave Abrahams <dave@boostpro.com>
Cc: larsi@gnus.org, 8890@debbugs.gnu.org
Subject: bug#8890: 23.3; message writing slows emacs
Date: Fri, 16 Sep 2011 11:54:28 +0300	[thread overview]
Message-ID: <83litovpdn.fsf@gnu.org> (raw)
In-Reply-To: <m2mxeb11ac.fsf@boostpro.com>

> From: Dave Abrahams <dave@boostpro.com>
> Cc: Lars Magne Ingebrigtsen <larsi@gnus.org>,  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.





  parent reply	other threads:[~2011-09-16  8:54 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-18 16:45 bug#8890: 23.3; message writing slows emacs Dave Abrahams
2011-09-11  4:32 ` Lars Magne Ingebrigtsen
2011-09-11  6:54   ` Dave Abrahams
2011-09-11  8:55     ` Eli Zaretskii
2011-09-11 10:45       ` Dave Abrahams
2011-09-11 11:20         ` Eli Zaretskii
2011-09-11 11:30           ` Dave Abrahams
2011-09-11 14:52             ` Lars Magne Ingebrigtsen
2011-09-11 15:58               ` Eli Zaretskii
2011-09-11 16:39                 ` Dave Abrahams
2011-09-16  2:22                   ` Dave Abrahams
2011-09-16  8:54                   ` Eli Zaretskii [this message]
2011-09-11 14:51         ` Lars Magne Ingebrigtsen
2011-09-16 13:18 ` Stefan Monnier
2011-09-16 13:45   ` Eli Zaretskii
2011-09-16 14:20     ` Stefan Monnier
2011-09-16 15:11       ` Dave Abrahams
2011-09-17  5:19         ` Lars Magne Ingebrigtsen
2011-09-17  6:23           ` Dave Abrahams
2011-09-17  8:25           ` Eli Zaretskii
2011-09-17  8:29             ` Lars Magne Ingebrigtsen
2011-09-17  9:24               ` Eli Zaretskii
2011-09-17 12:01               ` Juri Linkov
2011-09-17 21:06           ` Stefan Monnier
2011-09-18  6:50             ` Lars Magne Ingebrigtsen
2011-09-18 13:16               ` Stefan Monnier
2011-09-21 19:01                 ` Lars Magne Ingebrigtsen
2022-04-26 13:20           ` Lars Ingebrigtsen
2011-09-16 15:09     ` Dave Abrahams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83litovpdn.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=8890@debbugs.gnu.org \
    --cc=dave@boostpro.com \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).