* [PATCH] improve performance of stat() operations (e.g. ls -lR)
@ 2002-05-27 1:46 Don Bowman
2002-05-28 16:19 ` Scott Evans
0 siblings, 1 reply; 2+ messages in thread
From: Don Bowman @ 2002-05-27 1:46 UTC (permalink / raw)
To: 'cygwin-patches@cygwin.com ', 'cygwin@cygwin.com'
[-- 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/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-05-28 20:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-27 1:46 [PATCH] improve performance of stat() operations (e.g. ls -lR) Don Bowman
2002-05-28 16:19 ` Scott Evans
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).