[PATCH v4 5/7] Introduce _notmuch_message_has_term()
[notmuch-archives.git] / 16 / b3c9ba4461198705705f52f6d3027dc948d3d6
1 Return-Path: <tom.prince@ualberta.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 20A92429E25\r
6         for <notmuch@notmuchmail.org>; Sun, 27 Nov 2011 10:41:03 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 3Al1HnpWyU5R for <notmuch@notmuchmail.org>;\r
16         Sun, 27 Nov 2011 10:41:02 -0800 (PST)\r
17 Received: from socrates.hocat.ca (socrates.hocat.ca [76.10.188.53])\r
18         by olra.theworths.org (Postfix) with ESMTP id 823DC431FB6\r
19         for <notmuch@notmuchmail.org>; Sun, 27 Nov 2011 10:41:02 -0800 (PST)\r
20 Received: from hermes.hocat.ca (hermes.hocat.ca [69.165.170.253])\r
21         by socrates.hocat.ca (Postfix) with SMTP id 567CC14B1;\r
22         Sun, 27 Nov 2011 11:40:58 -0700 (MST)\r
23 Received: (nullmailer pid 9107 invoked by uid 1000);\r
24         Sun, 27 Nov 2011 18:40:57 -0000\r
25 From: Tom Prince <tom.prince@ualberta.net>\r
26 To: Notmuch Mail <notmuch@notmuchmail.org>\r
27 Subject: [PATCH] dump: Don't sort the output by message id.\r
28 Date: Sun, 27 Nov 2011 13:40:53 -0500\r
29 Message-Id: <1322419253-9071-1-git-send-email-tom.prince@ualberta.net>\r
30 X-Mailer: git-send-email 1.7.6.1\r
31 In-Reply-To: <1319884657-5574-1-git-send-email-thomas@schwinge.name>\r
32 References: <1319884657-5574-1-git-send-email-thomas@schwinge.name>\r
33 Cc: Thomas Schwinge <thomas@schwinge.name>\r
34 X-BeenThere: notmuch@notmuchmail.org\r
35 X-Mailman-Version: 2.1.13\r
36 Precedence: list\r
37 List-Id: "Use and development of the notmuch mail system."\r
38         <notmuch.notmuchmail.org>\r
39 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
40         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
42 List-Post: <mailto:notmuch@notmuchmail.org>\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
44 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
46 X-List-Received-Date: Sun, 27 Nov 2011 18:41:03 -0000\r
47 \r
48 From: Thomas Schwinge <thomas@schwinge.name>\r
49 \r
50 Asking xapian to sort the messages for us causes suboptimal IO patterns. This\r
51 would be useful, if we only wanted the first few results, but since we want\r
52 everything anyway, this is pessimization.\r
53 \r
54 On 2011-10-29, a measurement on a 372981 messages instance showed that wall\r
55 time can be reduced from 28 minutes (sorted by Message-ID) to 15 minutes\r
56 (unsorted).\r
57 \r
58 Timings on 189605 messages:\r
59 \r
60 $ time notmuch.old dump\r
61 19.48user 5.83system 12:10.42elapsed 3%CPU (0avgtext+0avgdata 110656maxresident)k\r
62 3629584inputs+22720outputs (33major+7073minor)pagefaults 0swaps\r
63 $ echo 3 > /proc/sys/vm/drop_caches\r
64 $ time notmuch.new\r
65 14.89user 1.20system 3:23.58elapsed 7%CPU (0avgtext+0avgdata 46032maxresident)k\r
66 1256264inputs+22464outputs (43major+1990minor)pagefaults 0swaps\r
67 ---\r
68  This just moves the motivation to the commit message, and adds more detailed timing information.\r
69 \r
70  notmuch-dump.c |    5 ++++-\r
71  1 files changed, 4 insertions(+), 1 deletions(-)\r
72 \r
73 diff --git a/notmuch-dump.c b/notmuch-dump.c\r
74 index 126593d..0475eb9 100644\r
75 --- a/notmuch-dump.c\r
76 +++ b/notmuch-dump.c\r
77 @@ -73,7 +73,10 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[])\r
78         fprintf (stderr, "Out of memory\n");\r
79         return 1;\r
80      }\r
81 -    notmuch_query_set_sort (query, NOTMUCH_SORT_MESSAGE_ID);\r
82 +    /* Don't ask xapian to sort by Message-ID. Xapian optimizes returning the\r
83 +     * first results quickly at the expense of total time.\r
84 +     */\r
85 +    notmuch_query_set_sort (query, NOTMUCH_SORT_UNSORTED);\r
86  \r
87      for (messages = notmuch_query_search_messages (query);\r
88          notmuch_messages_valid (messages);\r
89 -- \r
90 1.7.6.1\r
91 \r