bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8890: 23.3; message writing slows emacs


From: Eli Zaretskii
Subject: bug#8890: 23.3; message writing slows emacs
Date: Fri, 16 Sep 2011 11:54:28 +0300

> From: Dave Abrahams <address@hidden>
> Cc: Lars Magne Ingebrigtsen <address@hidden>,  address@hidden
> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]