Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 2f / 637779d71fe70bb6a44a3dbf380f2f43790cff
1 Return-Path: <kzak@redhat.com>\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 CAC38431FB6\r
6         for <notmuch@notmuchmail.org>; Fri,  4 Feb 2011 13:45:11 -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: -5\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-5 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_HI=-5] 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 rVyzu0IWKlpE for <notmuch@notmuchmail.org>;\r
16         Fri,  4 Feb 2011 13:45:10 -0800 (PST)\r
17 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\r
18         by olra.theworths.org (Postfix) with ESMTP id A414A431FB5\r
19         for <notmuch@notmuchmail.org>; Fri,  4 Feb 2011 13:45:10 -0800 (PST)\r
20 Received: from int-mx01.intmail.prod.int.phx2.redhat.com\r
21         (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\r
22         by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p14LjAi6003573\r
23         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)\r
24         for <notmuch@notmuchmail.org>; Fri, 4 Feb 2011 16:45:10 -0500\r
25 Received: from nb.net.home (vpn-238-160.phx2.redhat.com [10.3.238.160])\r
26         by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP\r
27         id p14Lj8JO024777; Fri, 4 Feb 2011 16:45:09 -0500\r
28 From: Karel Zak <kzak@redhat.com>\r
29 To: notmuch@notmuchmail.org\r
30 Subject: [PATCH] new: read db_files and db_subdirs if mtime changed\r
31 Date: Fri,  4 Feb 2011 22:44:31 +0100\r
32 Message-Id: <1296855871-15702-1-git-send-email-kzak@redhat.com>\r
33 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11\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: Fri, 04 Feb 2011 21:45:11 -0000\r
47 \r
48 The db_files and db_subdirs are unnecessary for unchanged directories.\r
49 \r
50 maildir with 10000 e-mails:\r
51 \r
52 old version:\r
53         $ time ./notmuch new\r
54         No new mail.\r
55 \r
56         real    0m0.053s\r
57         user    0m0.028s\r
58         sys     0m0.026s\r
59 \r
60 new version:\r
61         $ time ./notmuch new\r
62         No new mail.\r
63 \r
64         real    0m0.032s\r
65         user    0m0.009s\r
66         sys     0m0.023s\r
67 \r
68 Signed-off-by: Karel Zak <kzak@redhat.com>\r
69 ---\r
70  notmuch-new.c |   15 ++++++---------\r
71  1 files changed, 6 insertions(+), 9 deletions(-)\r
72 \r
73 diff --git a/notmuch-new.c b/notmuch-new.c\r
74 index 941f9d6..31d4553 100644\r
75 --- a/notmuch-new.c\r
76 +++ b/notmuch-new.c\r
77 @@ -247,15 +247,7 @@ add_files_recursive (notmuch_database_t *notmuch,\r
78      directory = notmuch_database_get_directory (notmuch, path);\r
79      db_mtime = notmuch_directory_get_mtime (directory);\r
80  \r
81 -    if (db_mtime == 0) {\r
82 -       new_directory = TRUE;\r
83 -       db_files = NULL;\r
84 -       db_subdirs = NULL;\r
85 -    } else {\r
86 -       new_directory = FALSE;\r
87 -       db_files = notmuch_directory_get_child_files (directory);\r
88 -       db_subdirs = notmuch_directory_get_child_directories (directory);\r
89 -    }\r
90 +    new_directory = db_mtime ? FALSE : TRUE;\r
91  \r
92      /* If the database knows about this directory, then we sort based\r
93       * on strcmp to match the database sorting. Otherwise, we can do\r
94 @@ -328,6 +320,11 @@ add_files_recursive (notmuch_database_t *notmuch,\r
95      if (fs_mtime == db_mtime)\r
96         goto DONE;\r
97  \r
98 +    if (!new_directory) {\r
99 +       db_files = notmuch_directory_get_child_files (directory);\r
100 +       db_subdirs = notmuch_directory_get_child_directories (directory);\r
101 +    }\r
102 +\r
103      /* Pass 2: Scan for new files, removed files, and removed directories. */\r
104      for (i = 0; i < num_fs_entries; i++)\r
105      {\r
106 -- \r
107 1.7.3.4\r
108 \r