This is the mail archive of the cygwin@sourceware.cygnus.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: b19 file I/O


Jacob Langseth <jlangseth@esisys.com> writes:
> [message about slow file I/O]

        After encountering some similar problems with file I/O in B19 being
a real dog, I fiddled with STRACE a bit and then dug around in the sources,
and determined that most of the file I/O being done in B19 gets done in 1K
chunks!    This works just fine on a local NTFS drive, but it blows on a FAT
drive and causes at least a 50% (sometimes 70-80%) slowdown over our
network, as compared to unfiltered win32 calls.

        The solution, if you can use it, is to change the code to use the
system fileIO calls instead of the stream calls, and use the largest blocks
you can.  read(bighonkinblock) and write(bighonkinblock) consistently
outperform fread() and fwrite() on this platform.  Unfortunately, many of
the fileutils and other supplied tools use stat()/fstat() to figure out the
blocksize of a file, and mistakenly assume that this will be the most
efficient size to use.  Windows internally mangles all I/O requests, so
messing around with blocksizes when reading/writing the files just thrashes
the cache instead of accomplishing what it should.

        Careful examination of the winsup sources revealed that we didn't
really want to mess with them :), so we are just living with the slowdown
and trying to make sure that our internal tools don't use fread() to get
large files over the network.
-dave                                         ________  _______ ____
---------------------------------------------/_ \     \/|  ___ \    \- -
David O'Riva - Staff Programmer                /|  |\  \|  ____/ /\  \
   oriva@agames.com                            /|  |/  /|  |\/\  \/  /\
                                              __|_____o/|__o\ /\____o\ 
                                          ---/________\/____\--/____\-- -
DISCLAIMER: Any opinions expressed here are mine, *not* my employer's.

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


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