Re: [PATCH] emacs: Use a single buffer invisibility spec to fix quadratic search cost.

Subject: Re: [PATCH] emacs: Use a single buffer invisibility spec to fix quadratic search cost.

Date: Fri, 11 Nov 2011 00:27:16 -0500

To: Pieter Praet

Cc: notmuch@notmuchmail.org, servilio

From: Austin Clements


Quoth myself on Nov 10 at 11:53 pm:
> Quoth Pieter Praet on Nov 11 at  4:04 am:
> > I've tried getting some hard numbers using
> > 
> >   #+begin_src sh
> >     time emacs --eval '(progn
> >         (notmuch)
> >         (notmuch-search "*")
> >         (while (get-buffer-process (current-buffer))
> >             (sleep-for 0.1))
> >         (kill-emacs))'
> >   #+end_src
> > 
> > ... but the results vary wildly on subsequent runs.
> 
> For me, this doesn't actually display the results buffer (though I
> don't know why not), which means it won't test this, since the problem
> lies in the Emacs redisplay logic.

This may or may not actually be correct, but the following seems more
representative on my system:

    time emacs --eval '(progn
        (notmuch)
        (notmuch-search "*")
        (while (get-buffer-process (current-buffer))
            (redisplay)
            (sleep-for 0.1))
        (kill-emacs))'

This at least displays the buffer.  I also tried
(accept-process-output) instead of the (sleep-for 0.1), which clearly
behaved differently, but gave only slightly higher numbers.  If I
timed just the search part, to exclude emacs start-up, I would have a
better idea of which more closely matches my manual measurements.

Thread: