notmuch/emacs
Austin Clements 7023466ece Make keys of notmuch-tag-formats regexps and use caching
This modifies `notmuch-tag-format-tag' to treat the keys of
`notmuch-tag-formats' as (anchored) regexps, rather than literal
strings.  This is clearly more flexible, as it allows for prefix
matching, defining a fallback format, etc.  This may cause compatibility
problems if people have customized `notmuch-tag-formats' to match tags
that contain regexp specials, but this seems unlikely.

Regular expression matching has quite a performance hit over string
lookup, so this also introduces a simple cache from exact tags to
formatted strings.  The number of unique tags is likely to be quite
small, so this cache should have a high hit rate.  In addition to
eliminating the regexp lookup in the common case, this cache stores
fully formatted tags, eliminating the repeated evaluation of potentially
expensive, user-specified formatting code.  This makes regexp lookup at
least as fast as assoc for unformatted tags (e.g., inbox) and *faster*
than the current code for formatted tags (e.g., unread):

                    inbox (usec)   unread (usec)
    assoc:              0.4            2.8
    regexp:             3.2            7.2
    regexp+caching:     0.4            0.4

(Though even at 7.2 usec, tag formatting is not our top bottleneck.)

This cache must be explicitly cleared to keep it coherent, so this adds
the appropriate clearing calls.
2014-03-24 19:43:00 -03:00
..
.gitignore emacs: update .gitignore 2013-06-02 20:44:26 -03:00
coolj.el emacs: Add more functions to clean up text/plain parts 2010-04-26 10:05:46 -07:00
make-deps.el emacs: Compute build dependencies to fix byte compile issues 2013-05-23 08:06:12 -03:00
Makefile fix sum moar typos [build scripts, Makefiles] 2011-06-23 15:44:59 -07:00
Makefile.local emacs: Avoid rebuilding .eldeps even when there's nothing to do 2014-02-21 21:07:23 -04:00
notmuch-address.el emacs/notmuch-address.el: add notmuch-address-selection-function 2013-05-13 21:05:29 -03:00
notmuch-crypto.el emacs: show: make buttons select window 2013-02-18 20:13:19 -04:00
notmuch-hello.el emacs: remove newlines from input to notmuch count --batch 2014-02-25 20:53:19 -04:00
notmuch-lib.el emacs: Combine notmuch-combine-face-text-property{, -string} 2014-03-24 19:42:33 -03: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 emacs: derive correct timestamp in FCC unique name 2012-06-22 07:39:21 -03:00
notmuch-message.el emacs: replace (funcall 'foo ...) with (foo ...) 2013-06-02 11:37:22 -03:00
notmuch-mua.el emacs: Simplify and fix `notmuch-mua-prompt-for-sender' 2014-03-04 19:59:35 -04:00
notmuch-parser.el emacs: Streaming S-expression parser 2013-06-01 08:56:25 -03:00
notmuch-print.el emacs: Put notmuch-print-mechanism in custom group notmuch-show 2012-04-24 23:25:51 -03:00
notmuch-query.el emacs: dropped rest of now-unused JSON functionality 2013-07-20 09:13:48 -03:00
notmuch-show.el Make keys of notmuch-tag-formats regexps and use caching 2014-03-24 19:43:00 -03:00
notmuch-tag.el Make keys of notmuch-tag-formats regexps and use caching 2014-03-24 19:43:00 -03:00
notmuch-tree.el Make keys of notmuch-tag-formats regexps and use caching 2014-03-24 19:43:00 -03:00
notmuch-wash.el emacs: Retain text properties when toggling buttons 2013-05-31 22:00:44 -03:00
notmuch.el Make keys of notmuch-tag-formats regexps and use caching 2014-03-24 19:43:00 -03:00