public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Jonathan Kamens <jik@curl.com>
To: cygwin@cygwin.com
Subject: Optimizing away "ReadFile" calls when Make calls stat()
Date: Tue, 13 Feb 2001 10:36:00 -0000	[thread overview]
Message-ID: <20010213183634.1435.qmail@lizard.curl.com> (raw)

We use Cygwin to develop a large product (running a build and the test
suites takes about two hours on a very fast machine); our builds are
driven by GNU Make.  We compile and test the same product under Linux.
We've found that builds under Cygwin run several times slower than
builds under Linux, even on machines of comparable speed, RAM, etc.
The slowness is seriously impacting the productivity of our developers
who work on Windows, so we're searching for any way we can to speed up
Cygwin builds.

We've found that one of the biggest culprits in slowing down the
Cygwin builds is Make.  The problem is that every time Make does
stat() to find out the modification time on a dependency to determine
whether or not its dependents need to be rebuilt, Cygwin calls
ReadFile on the file twice -- once to determine whether it's a
symbolic link, and a second time to determine whether it should appear
to be executable according to stat().  We have thousands of
dependencies in our Makefiles, and many of those dependencies
frequently live on network drives, so these calls to ReadFile
seriously slow things down.

We don't use symbolic links anywhere in our source tree or build
tree, and Make doesn't really care whether a file is executable when
deciding whether it is newer than one of its dependents, so both of
these calls to ReadFile are totally unnecessary to us.  As an
experiment, I added code to the Cygwin DLL to allow these ReadFile
calls to be temporarily disabled, and then I compiled a modified
version of Make which disables the ReadFile calls before calling
stat() and then turns them back on.

To measure the effect of these changes, I ran "make all" in a build
tree tha was already completely built, so that I would be timing only
the work Make does to check dependencies, rather than timing actual
build work.  With the unmodified Make, "make all" takes around six
minutes; with the modified Make, it takes around three.  We consider
this a significant improvement.  (However, note that on Linux, "make
all" when nothing needs to be done takes only 17 seconds, so clearly
there's still a lot of room for improvement under Cygwin.)

I'm wondering if the maintainers of Cygwin would be willing to
consider incorporating these changes, if I submit them, into the
Cygwin DLL and the Cygwin version of Make.  I'm thinking that the DLL
changes would actually need to be split into two flags -- one to say,
"Don't call ReadFile to find out whether a file is executable, because
I don't care about that," and the other to say, "Don't call ReadFile
to find out if a file is a symbolic link, because I know I'm not using
any symbolic links."  Then, GNU Make on Cygwin could always set the
first flag, and it could set the second flag if the user specified
"--nosymlinks" or something like that.

I realize that this is a bit gross.  However, (a) surely it isn't much
more gross than storing symbolic links inside files and reading files
to determine whether they should look executable :-), and (b) it
really does give a drastic performance improvement for the small price
of not using symbolic links in your source or build tree.

Please comment.

Thanks,

  Jonathan Kamens

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

             reply	other threads:[~2001-02-13 10:36 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-13 10:36 Jonathan Kamens [this message]
2001-02-13 10:56 ` Larry Hall (RFK Partners, Inc)
2001-02-13 11:01   ` jik-cygwin
2001-02-13 11:14     ` Larry Hall (RFK Partners, Inc)
2001-02-13 11:18       ` jik-cygwin
2001-02-13 11:26         ` Larry Hall (RFK Partners, Inc)
2001-02-13 11:35     ` DJ Delorie
2001-02-13 11:46       ` jik-cygwin
2001-02-13 11:54         ` DJ Delorie
2001-02-13 11:56           ` Jonathan Kamens
2001-02-13 12:06             ` DJ Delorie
2001-02-13 12:31             ` Larry Hall (RFK Partners, Inc)
2001-02-13 12:22           ` Christopher Faylor
2001-02-13 12:50             ` DJ Delorie
2001-02-14  0:12             ` Egor Duda
2001-02-14  0:17               ` Robert Collins
2001-02-15 11:47               ` Warren Young
2001-02-15 13:14                 ` Larry Hall (RFK Partners, Inc)
2001-02-15 14:17                   ` Charles S. Wilson
2001-02-16  1:34                     ` Warren Young
2001-02-16  8:07                       ` Larry Hall (RFK Partners, Inc)
2001-02-16  9:00                         ` Christopher Faylor
2001-02-15 14:17                   ` Christopher Faylor
2001-02-15 14:19                   ` Jonathan Kamens
2001-02-16  1:14                 ` Egor Duda
2001-02-16  1:29                   ` Warren Young
2001-02-13 15:28         ` Warren Young
2001-02-14  0:48           ` Lothan
2001-02-13 11:12   ` Earnie Boyd
2001-02-13 11:46   ` Christopher Faylor
2001-02-13 11:09 ` Earnie Boyd
2001-02-13 11:15   ` jik-cygwin
2001-02-13 11:48     ` Earnie Boyd
2001-02-13 11:54       ` jik-cygwin
2001-02-13 12:25         ` DJ Delorie
2001-02-13 12:50           ` Larry Hall (RFK Partners, Inc)
2001-02-13 12:51             ` DJ Delorie
2001-02-13 13:37             ` jfaith
2001-02-13 13:50             ` Mumit Khan
2001-02-13 14:13               ` DJ Delorie
2001-02-13 12:11       ` DJ Delorie
2001-02-13 11:24 ` Eric M. Monsler
2001-02-13 11:28   ` jik-cygwin
2001-02-13 12:04     ` Eric M. Monsler
2001-02-13 14:15 Puttkammer, Roman
2001-02-13 14:28 ` Christopher Faylor
2001-02-14  2:41 Bernard Dautrevaux
2001-02-14  4:46 Bernard Dautrevaux
2001-02-16  9:24 Bernard Dautrevaux
2001-02-16 10:17 ` Christopher Faylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010213183634.1435.qmail@lizard.curl.com \
    --to=jik@curl.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).