[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] reducing system calls for file io
From: |
David Benbennick |
Subject: |
Re: [Nano-devel] reducing system calls for file io |
Date: |
Sun, 21 Apr 2002 21:59:53 -0400 |
On Sun, Apr 21, 2002 at 02:40:52PM -0400, Jay Carlson wrote: <snip>
> Why write more code?
>
> On Linux, glibc looks up the preferred block size of the file/filesystem
> (via stat.st_blksize) and uses that if available, rather than BUFSIZ.
>
> I agree that you should optimize for common tasks and for those that are
> sensitive to the user. But stdio does reasonably well at these kinds of
> IO tasks, it's been written already, it's maintained for you, and
> because so many apps use stdio its performance will be scrutinized by
> many people. Getting rid of code in your apps is a good thing.
Bravo! The code changed tonight and broke your patch. Attached is a
version updated so it applies to files.c,v 1.163.
> In order to keep the current tight control over open() options, file
> descriptors are open()ed and then converted to FILE * via fdopen().
It appears that the only "tight control" over open() not available to
fopen() is the "mode" parameter. But nano sets the modes later with
chmod() anyway. Thus, I think it would be fine to replace each open()
with fopen().
nano-cvs-stdio2.patch
Description: Text document
pgptpz_usq3EL.pgp
Description: PGP signature