make-w32
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FWD: Make CVS 7X slower on Win32 NTFS than beta 4


From: Eli Zaretskii
Subject: Re: FWD: Make CVS 7X slower on Win32 NTFS than beta 4
Date: Fri, 10 Feb 2006 12:35:09 +0200

> From: "J. David Bryan" <address@hidden>
> To: address@hidden
> Subject: Make CVS 7X slower on Win32 NTFS than beta 4
> Date: Thu, 09 Feb 2006 12:23:22 -0500
> 
> Running "filemon" from Sysinternals, I see that many more directory 
> accesses are performed with the CVS version than with beta 4 (~180K logged 
> lines for the CVS version vs. ~40K lines for beta 4).
> 
> I have traced the problem to a patch to "dir.c" that was applied on 
> February 1st.  This patch, to "dir_contents_file_exists_p", is to avoid 
> using variable "st" unless it's initialized.  However, the applied patch 
> also changes the logic at that point.
> 
> The CVS addition and the original patch are described here:
> 
>   http://lists.gnu.org/archive/html/make-w32/2006-02/msg00000.html
>   http://lists.gnu.org/archive/html/make-w32/2005-04/msg00033.html
> 
> The intent appears to be to reread the directory only if the "modified" 
> time is later than the stored time, or if the file system is FAT (which, 
> apparently, doesn't support directory modified times).  The CVS version, 
> though, causes the directory to be reread always.
> 
> The following revised patch would appear to fix the current problem, as 
> well as address the "st" initialization problem:

Thanks for catching this bug and for the patch.

Yes, it was stupid of me to cause this slowdown.  However, your patch
punishes the FAT filesystems unnecessarily by calling `stat' every
time a directory on such a filesystem is examined.  FAT systems were
already punished badly enough, so we could give them a break ;-)

Please try the following alternative patch.  Does it do The Right
Thing for you?

2006-02-10  Eli Zaretskii  <address@hidden>

        * dir.c (dir_contents_file_exists_p): Don't opendir if the
        directory time stamp didn't change, except on FAT filesystems.

--- dir.c~1     2006-02-02 06:11:44.171875000 +0200
+++ dir.c       2006-02-10 12:24:43.475125000 +0200
@@ -632,19 +632,26 @@ dir_contents_file_exists_p (struct direc
        */
       if (dir->path_key)
        {
-          if (!(dir->fs_flags & FS_FAT)
-              && (stat(dir->path_key, &st) == 0
-                  && st.st_mtime > dir->mtime))
-            /* reset date stamp to show most recent re-process */
-            dir->mtime = st.st_mtime;
+          if ((dir->fs_flags & FS_FAT) != 0)
+           {
+             dir->mtime = time ((time_t *) 0);
+             rehash = 1;
+           }
+         else if (stat(dir->path_key, &st) == 0 && st.st_mtime > dir->mtime)
+           {
+             /* reset date stamp to show most recent re-process */
+             dir->mtime = st.st_mtime;
+             rehash = 1;
+           }
 
-         /* make sure directory can still be opened */
-         dir->dirstream = opendir(dir->path_key);
+         if (rehash)
+           {
+             /* make sure directory can still be opened */
+             dir->dirstream = opendir(dir->path_key);
 
-         if (dir->dirstream)
-           rehash = 1;
-         else
-           return 0; /* couldn't re-read - fail */
+             if (!dir->dirstream)
+               return 0; /* couldn't re-read - fail */
+           }
        }
       else
 #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]