Jamie, Jameson Graef Rollins <jrollins@finestructure.net> writes: > On Mon, Jul 09 2012, Sebastien Binet <binet@cern.ch> wrote: >> I was trying to reduce the I/O stress during my usual email >> fetching+tagging by writing a little program using the go bindings to >> notmuch. >> >> ie: >> db, status := notmuch.OpenDatabase(db_path, >> notmuch.DATABASE_MODE_READ_WRITE) >> query := db.CreateQuery("(tag:new AND tag:inbox)") >> msgs := query.SearchMessages() >> for _,msg := range msgs { >> tag_msg(msg, tagqueries) >> } >> >> >> where tagqueries is a subquery of the form: >> [ >> { >> "Cmd": "+to-me", >> "Query": "(to:sebastien.binet@cern.ch and not tag:to-me)" >> }, >> { >> "Cmd": "+sci-notmuch", >> "Query": "from:notmuch@notmuchmail.org or to:notmuch@notmuchmail.org or subject:notmuch" >> } >> ] > > > Hi, Sebastian. It's really hard for me to believe that this is much > faster than simply making the two tagging calls in full: > > notmuch tag +to-me -- tag:new and tag:inbox and (to:sebastien.binet@cern.ch and not tag:to-me) > notmuch tag +sci-notmuch -- tag:new and tag:inbox and from:notmuch@notmuchmail.org or to:notmuch@notmuchmail.org or subject:notmuch" > > After the first call the cache will be fresh, so the overhead should be > minimal. It looks to me you're looking in to this as a post-new hook. > I do pretty much the same thing, and with the above properly constructed > searches the tagging is super fast. well, of course I don't have just those two: $ grep -He "^tag_new " emacs/notmuch-lib/notmuch-tag.sh | wc -l 54 also: $ du -hs mail-notmuch/.notmuch 2.9G mail-notmuch/.notmuch that said, most of the I/O wait seem to come from 'notmuch new' (after having dropped all fs caches.) ok, post-new hook it is then :) (but there is probably something to do to speed-up a 'notmuch new' after having dropped all fs caches... ?) -s