emacs-devel
[Top][All Lists]
Advanced

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

Re: What makes set-window-buffer slow?


From: Eli Zaretskii
Subject: Re: What makes set-window-buffer slow?
Date: Fri, 24 Jun 2016 16:56:47 +0300

> Cc: address@hidden, address@hidden, address@hidden
> From: Clément Pit--Claudel <address@hidden>
> Date: Fri, 24 Jun 2016 08:33:25 -0400
> 
> >> On 2016-06-23 15:11, Eli Zaretskii wrote:
> >>> Instead of hypothesizing, I suggest to profile your code with 
> >>> profiler.el.  If indeed redisplay is taking the time, you should
> >>> see that in the profile.
> >> 
> >> The profile doesn't show that, unfortunately; in fact, we spent a
> >> significant amount of time trying to understand what was taking all
> >> that time by looking at the profile, but nothing in there was
> >> taking more than 30% of the time, and even optimizing away a
> >> function that according to the profile took 28% of the time didn't
> >> yield a measurable runtime difference.
> >> 
> >> Commenting out the call to set-window-buffer (or predicating it on
> >> the window not already displaying the buffer), on the other hand,
> >> does yield a 95% performance gain.  set-window-buffer does not
> >> appear in the profile; redisplay_internal does appear, but it only
> >> is credited with 30% of the execution time.
> >> 
> >> I wonder what might explain these results...
> > 
> > Any hope of seeing the profile, fully expanded?
> 
> Absolutely. I've attached it.

Looks like redisplay is indeed an important factor here.

In addition, it looks like you have some subprocess from which you
read input?  What's the part of profile below about?

  - scomint-output-filter                                           173  26%
   - run-hook-with-args                                             173  26%
    - proof-shell-filter-wrapper                                    169  26%
     - byte-code                                                    169  26%
      - proof-shell-filter                                          160  24%
       - proof-shell-filter-manage-output                           137  21%
        - proof-shell-exec-loop                                     123  19%
         - mapc                                                      95  14%
          - proof-shell-invoke-callback                              93  14%
           - byte-code                                               93  14%
            - proof-done-advancing                                   93  14%

Can you write some high-level overview of what the inner loop of your
code does, including what is being redisplayed, and how input from
subprocesses enters the picture?

In addition, I suggest to run your benchmark several times, so as to
eliminate the significant portion of time execute-extended-command and
its subroutines, and the profiler itself, show in the profile?  Also,
load all the Lisp libraries as *.el files, so that the profile is more
detailed.



reply via email to

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