notmuch/emacs
Austin Clements a2d78fba20 emacs: Use a single buffer invisibility spec to fix quadratic search cost.
Buffer redisplay requires traversing the buffer's invisibility spec
for every part of the display that has an 'invisible text or overlay
property.  Previously, the search buffer's invisibility spec list
contained roughly one entry for each search result.  As a result,
redisplay took O(NM) time where N is the number of visible lines and M
is the total number of results.  On a slow computer, this is enough to
make even buffer motion noticeably slow.  Worse, during a search
operation, redisplay is triggered for each search result (even if
there are no visible buffer changes), so search was quadratic
(O(NM^2)) in the number of search results.

This change switches to using a single element buffer invisibility
spec.  To un-hide authors, instead of removing an entry from the
invisibility spec, it simply removes the invisibility overlay from
those authors.

I tested using a query with 6633 results on a 9 year old machine.
Before this patch, Emacs took 70 seconds to fill the search buffer;
toward the end of the search, Emacs consumed 10-20x as much CPU as
notmuch; and moving point in the buffer took about a second.  With
this patch, the same query takes 40 seconds, Emacs consumes ~3x the
CPU of notmuch by the end, and there's no noticeable lag to moving
point.  (There's still some source of non-linearity, because Emacs and
notmuch consume roughly the same amount of CPU early in the search.)
2011-11-12 09:21:03 -05:00
..
coolj.el emacs: Add more functions to clean up text/plain parts 2010-04-26 10:05:46 -07:00
Makefile fix sum moar typos [build scripts, Makefiles] 2011-06-23 15:44:59 -07:00
Makefile.local Separate Emacs misc. files dir. from Emacs code dir. 2011-10-28 14:07:44 -03:00
notmuch-address.el emacs: Tell the user how many addresses matched when completing 2010-04-26 10:58:42 -07:00
notmuch-crypto.el emacs: Add callback functions to crypto sigstatus button. 2011-10-06 10:30:25 -03:00
notmuch-hello.el fix sum moar typos [comments in source code] 2011-06-23 15:58:39 -07:00
notmuch-lib.el emacs: remove unused `point-invisible-p' function 2011-11-07 20:38:37 -04:00
notmuch-logo.png emacs: Add notmuch-hello.el, a friendly frontend to notmuch 2010-04-23 12:50:18 -07:00
notmuch-maildir-fcc.el fix sum moar typos [error messages] 2011-06-23 15:59:03 -07:00
notmuch-message.el emacs: add notmuch-before- and notmuch-after-tag-hook 2011-05-24 13:28:41 -07:00
notmuch-mua.el fix checking whether header is member of message-hidden-headers 2011-08-25 09:08:04 -03:00
notmuch-query.el emacs: Add support for PGP/MIME verification/decryption 2011-05-27 16:22:00 -07:00
notmuch-show.el emacs: remove no longer used functions from notmuch-show.el 2011-11-07 20:38:37 -04:00
notmuch-wash.el fix sum moar typos [user-visible documentation in code] 2011-06-23 15:58:50 -07:00
notmuch.el emacs: Use a single buffer invisibility spec to fix quadratic search cost. 2011-11-12 09:21:03 -05:00