On 12/20/09 7:02 PM, James Westby wrote:
From: Tomas Carnecky<t...@dbservice.com>

Use stat(2) instead.

Signed-off-by: Tomas Carnecky<t...@dbservice.com>
Signed-off-by: James Westby<jw+deb...@jameswestby.net>
---

   The original patch duplicated asprintf and stat calls, rearraging
   the code means we don't need to.

   I have a concern about the duplicated stats in is_maildir, but they
   are not so easy to save. I ran a quick timing test (3931 files), dropping
   caches before each set:

     master:
       real  2m3.545s
       real  1m34.571s
       real  1m36.005s

     original patch:
       real  2m18.114s
       real  1m34.843s
       real  1m36.317s

     revised patch:
       real  2m5.890s
       real  1m36.387s
       real  1m36.453s

   This shoes there is little impact of the code, but given that it is
   around one percent we may want to make it conditional on platform
   and save the extra stat calls.

If performance regression is an issue, something like this could be used to keep the current code paths in linux and stat() on other platforms:

static bool
is_dir(const char *path, struct dirent *dirent)
{
#if defined(__sun__)
        ... sprintf, stat etc
#else
        (void) path;
        return dirent->d_type == DT_DIR;
#endif
}

tom

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to