This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Gmake is slow under cygwin


Here are the changes we've made recently to our build environment to
speed up builds with GNU Make under Cygwin....

1) Enabled the "exec" option on nearly all of our cygwin mount
   points.

2) Call Make with "-r" to disable all predefined rules.  If you use
   any of the predefined rules in your builds, you can simply define
   them explicitly in your templates.

   This is significant because the predefined rules do things like
   cause Make to look for RCS and SCCS files corresponding to every
   single dependency file.  All of these unnecessary file accesses
   slow things down significantly.

   I believe that one of the predefined rules disabled by "-r" is the
   "rebuild Makefile automatically" predefined rule that somebody else
   mentioned.

3) Put "SHELL=/bin/sh" in our Makefile templates.  This has two
   effects:

   a) Without it, Make searches for "sh.exe" in its search path.  The
      file accesses necessary to find "sh.exe" are significant,
      especially when your build system uses a number of invocations
      of Make rather than doing everything in a single Make process (I
      couldn't tell which of these models you use).

   b) Make optimizes away the command "/bin/sh -c :" so that a shell
      never actually gets spawned, but only that *exact* command.  For
      example, "sh.exe -c :" does *not* get optimized away.  If you
      have lots of rules which use the empty command ":" as a
      placeholder (and we do), this optimization is important.

We also set the CYGWIN environment variable to "binmode tty" for all
of our users and builds.  I don't know whether "binmode" has any
effect on performance; I suppose it's possible that it does.

Finally, we did some Windows NT performance tweaking, some of which
might also be applicable on Windows NT.  Perhaps my colleague John
Pollack, who did that work, can provide more details :-).

To find out what's hogging resources in your Make, run "strace make"
instead of "make", with stdout and stderr redirected into a log file
(which will end up being quite large).  Then read through the log file
and you can see what Make is actually doing.  Look in particular at
file operations like "stat" and process forks ("spawn").  This may
give you some clues about what you can optimize.  This enabled us to
eliminate a large number of unnecessary file operations and speed up
our builds significantly.

  jik

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]