make-w32
[Top][All Lists]
Advanced

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

Re: performance issue with cgywin make


From: Bill Hoffman
Subject: Re: performance issue with cgywin make
Date: Fri, 08 Dec 2006 21:46:18 -0500
User-agent: Thunderbird 1.5.0.8 (Windows/20061025)

Christopher Faylor wrote:

e you'd have headaches with the emulated POSIX paths.

Right.  That plus the whole point of Cygwin (MSYS) is to use the
linux-like interface.
This maybe true, but the performance increase for make could be significant. I just created
a small test program and did some timings.

Here is the same program using stat on about 500000 files,
basically, the same 550 files 1000 times.

$ time ./stat stat VTK/Common/*  VTK/Graphics/*.cxx
testing stat on 552000 files

real    0m39.404s
user    0m0.031s
sys     0m0.062s


Here are the same files done with the native windows call:
$ time ./stat wstat VTK/Common/*  VTK/Graphics/*.cxx
testing win stat on 552000 files

real    0m13.295s
user    0m0.030s
sys     0m0.093s

So, the windows native stat is about 3 X faster. That would explain my original post that nmake is about twice as fast as gmake. The above was done with the microsoft compiler. It gets even worst if I use gcc, so the cygwin stat appears to be even slower.

$ time ./a.exe wstat VTK/Common/*  VTK/Graphics/*.cxx
testing win stat on 552000 files

real    0m14.002s
user    0m1.155s
sys     0m12.030s

$ time ./a.exe stat VTK/Common/* VTK/Graphics/*.cxx
testing stat on 552000 files

real    1m14.410s
user    0m7.249s
sys     0m58.500s

So, with cygwin stat verses cygwin calling the native windows stat it is 5 X faster to
do the native call.

Here is the program I used:

#include <iostream>
#include <sys/stat.h>
#include <windows.h>
#include <stdio.h>


__int64 GetStatMtime(const char* f)
{
 struct stat s1;
 if(stat(f, &s1) != 0)
   {
   return -1;
   }
 return s1.st_mtime;
}

int GetWinMtime(const char* f)
{
 WIN32_FILE_ATTRIBUTE_DATA f1d;
 if(!GetFileAttributesEx(f, GetFileExInfoStandard, &f1d))
   {
   return -1;
   }
 return f1d.ftLastWriteTime.dwHighDateTime;
}

int main(int ac, char** av)
{
 if(strcmp(av[1], "stat") == 0)
   {
   std::cerr << "testing stat on " << ac * 1000 << " files\n";
   for(int k = 0; k < 1000; k++)
     {
     for(int i =2; i < ac; i++)
       {
       if(GetStatMtime(av[i]) == -1)
         {
         std::cerr << "error on file " << av[i] << "\n";
         }
       }
     }
   }
 else
   {
   std::cerr << "testing win stat on " << ac * 1000 << " files\n";
   for(int k = 0; k < 1000; k++)
     {
     for(int i =2; i < ac; i++)
       {
       if(GetWinMtime(av[i]) == -1)
         {
         std::cerr << "error on file " << av[i] << "\n";
         }
       }
     }
   }
}

-Bill





reply via email to

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