From: Don Bowman <don@sandvine.com>
To: "'cygwin-patches@cygwin.com '" <cygwin-patches@cygwin.com>,
"'cygwin@cygwin.com'" <cygwin@cygwin.com>
Subject: [PATCH] improve performance of stat() operations (e.g. ls -lR)
Date: Mon, 27 May 2002 01:46:00 -0000 [thread overview]
Message-ID: <FE045D4D9F7AED4CBFF1B3B813C85337676293@mail.sandvine.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 378 bytes --]
The attached patch adds a new CYGWIN environment variable, statquery. This
causes stat() to use set_query_open(TRUE) all the time, which
dramatically improves the performance on e.g. ls -lR operations or
configure.
For example, an ls -lR of the 'ntop' distribution goes from 34seconds
to 2seconds on my computer on a local filesystem. The actual change
is extremely trivial.
[-- Attachment #2: statquery.diff --]
[-- Type: application/octet-stream, Size: 1984 bytes --]
--- src/winsup/cygwin/environ.cc 2002-05-24 22:22:50.000000000 -0400
+++ src-new/winsup/cygwin/environ.cc 2002-05-26 16:23:31.000000000 -0400
@@ -36,6 +36,7 @@ extern BOOL allow_winsymlinks;
extern BOOL strip_title_path;
extern int pcheck_case;
extern int subauth_id;
+extern BOOL stat_open_noread;
BOOL reset_com = FALSE;
static BOOL envcache = TRUE;
@@ -525,6 +526,7 @@ static struct parse_thing
{"title", {&display_title}, justset, NULL, {{FALSE}, {TRUE}}},
{"tty", {NULL}, set_process_state, NULL, {{0}, {PID_USETTY}}},
{"winsymlinks", {&allow_winsymlinks}, justset, NULL, {{FALSE}, {TRUE}}},
+ {"statquery", {&stat_open_noread}, justset, NULL, {{FALSE},{TRUE}}},
{NULL, {0}, justset, 0, {{0}, {0}}}
};
--- src/winsup/cygwin/fhandler_disk_file.cc 2002-05-24 01:44:10.000000000 -0400
+++ src-new/winsup/cygwin/fhandler_disk_file.cc 2002-05-26 16:05:46.000000000 -0400
@@ -31,6 +31,8 @@ details. */
#define _COMPILING_NEWLIB
#include <dirent.h>
+BOOL stat_open_noread;
+
static int
num_entries (const char *win32_name)
{
@@ -72,7 +74,7 @@ fhandler_disk_file::fstat (struct __stat
if (!pc)
return fstat_helper (buf);
- if ((oret = open (pc, open_flags, 0)))
+ if (!stat_open_noread && (oret = open (pc, open_flags, 0)))
/* ok */;
else
{
--- src/winsup/cygwin/ChangeLog 2002-05-24 22:22:50.000000000 -0400
+++ src-new/winsup/cygwin/ChangeLog 2002-05-26 17:29:11.000000000 -0400
@@ -1,3 +1,12 @@
+2002-05-26 Don Bowman <don@sandvine.com>
+
+ * Add new CYGWIN option, 'statquery', which causes the
+ stat() call to use the set_query_open(TRUE) all the time.
+ This significantly improves performance on e.g. ls -lR
+ operation. It would appear the CreateFile() on windows
+ reads a good chunk of the file when called for reading,
+ which isn't needed by stat().
+
2002-05-24 Christopher Faylor <cgf@redhat.com>
Remove unneeded sync.h, where appropriate, throughout.
[-- Attachment #3: Type: text/plain, Size: 214 bytes --]
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
next reply other threads:[~2002-05-26 21:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-27 1:46 Don Bowman [this message]
2002-05-28 16:19 ` Scott Evans
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=FE045D4D9F7AED4CBFF1B3B813C85337676293@mail.sandvine.com \
--to=don@sandvine.com \
--cc=cygwin-patches@cygwin.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).