notmuch: Use Query.count_messages() rather len(Query.search_messages())
authorSebastian Spaeth <sebastian@sspaeth.de>
Fri, 19 Mar 2010 07:47:14 +0000 (08:47 +0100)
committerSebastian Spaeth <sebastian@sspaeth.de>
Fri, 19 Mar 2010 07:47:14 +0000 (08:47 +0100)
In my tests, this is about 10 times faster and returned the same results,
although both operations are really fast.

notmuch

diff --git a/notmuch b/notmuch
index 6e41fa21bd26f23578d423acfa149fae5bcf04c8..5fc98bbef52a1ac5674edc97b225aba36882453e 100755 (executable)
--- a/notmuch
+++ b/notmuch
@@ -149,7 +149,8 @@ if __name__ == '__main__':
          #mangle arguments wrapping terms with spaces in quotes
          querystr = quote_query_line(sys.argv[2:])
       logging.debug("count "+querystr)
-      print(len(Query(db,querystr).search_messages()))
+      print(Query(db,querystr).count_messages())
+      
    #-------------------------------------
    elif sys.argv[1] == 'tag':
       #build lists of tags to be added and removed