From: Warren Young <warren@etr-usa.com>
To: Cygwin-L <cygwin@cygwin.com>
Subject: Re: Optimizing away "ReadFile" calls when Make calls stat()
Date: Tue, 13 Feb 2001 15:28:00 -0000 [thread overview]
Message-ID: <3A89C304.89BD74A0@etr-usa.com> (raw)
In-Reply-To: <20010213194612.17311.qmail@lizard.curl.com>
jik-cygwin@curl.com wrote:
>
> As I've noted separately, reading tens of thousands of files even once
> incurs a significant performance penalty. The change I've proposed
> can eliminate reading them at all.
Even stat() under Linux does at least one disk read. You can't
completely optimize away disk I/O for stat().
The main culprit is that this is one of many places where Unix doesn't
map onto Win32 well at all. The VC++ RTL doesn't use ReadFile() to
implement _stat() at all. When it checks for things like stat.st_mode
== S_IEXEC, it simply checks the filename extension for .exe, .com or
.bat. Cygwin can't do that -- it must look at the file's magic bytes to
see if it's an executable, or a #! style script.
stat() on Unixen doesn't do either of these things; all the info stat()
reports is in the inode. The info in a prototypical Unix inode is
scattered in many different places in Win32, which makes the emulator
for a call like stat() slow.
Maybe a better optimization strategy would be to patch GNU Make.
Wherever it does a stat() to find the modification time, do something
like this:
struct stat st;
#ifdef CYGWIN
WIN32_FIND_DATA findinfo;
HANDLE h = FindFirstFile(filename, &findinfo);
st.st_mtime = findinfo.ftLastWriteTime;
FindClose(h);
#else
stat(filename, &st);
#endif
(ftLastWriteTime will probably need translation into a time_t, but
that's a small matter.)
-- _
= 'Net Address: http://www.cyberport.com/~tangent | / \ ASCII Ribbon
= ICBM Address: 36.82740N, 108.02040W, alt. 1714m | \ / Campaign
= | X Against
= Chance favors the prepared mind. | / \ HTML Mail
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
next prev parent reply other threads:[~2001-02-13 15:28 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-13 10:36 Jonathan Kamens
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 ` Christopher Faylor
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:19 ` Jonathan Kamens
2001-02-16 1:14 ` Egor Duda
2001-02-16 1:29 ` Warren Young
2001-02-13 15:28 ` Warren Young [this message]
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=3A89C304.89BD74A0@etr-usa.com \
--to=warren@etr-usa.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).