Subject: Re: b19 file I/O
From: [email-masked] (David O'Riva)

2 Apr 1998 20:10:53 -0800
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
To: [email-masked]
Cc: [email-masked]

Jacob Langseth <[email-masked]> 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                /|  |\  \|  ____/ /\  \
   [email-masked]                            /|  |/  /|  |\/\  \/  /\
                                              __|_____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
"[email-masked]" with one line of text: "help".