[EMAIL PROTECTED] writes:
> > > > [mrsam@ny mrsam]$ cat t.c
> > > > #include <stdio.h>
> > > >
> > > > char buf[8192];
> > > >
> > > > int main(int argc, char **argv)
> > > > {
> > > > int i;
> > > > char *p;
> > > >
> > > > memset(buf, 0, sizeof(buf));
> > > >
> > > > p=buf;
> > > > for (i=0; i<sizeof(buf); i++)
> > > > *p++=0;
> > > >
> > > > write(1, sizeof(buf), 1);
> > > > return (0);
> > > > }
> > >
> > > (Did you try running this program - the second param
> > > to write should be an address, not a size_t)?
> >
> > Perhaps you haven't noticed the time() output, right there in the middle
> > of my post.
>
> I did. It's way too small to indicate anything but noise.
>
> On Solaris an empty program issues some 19 system calls including
> 2 opens. A write() of 1 byte surely gets lost in the noise.
There's a saying down there in Washington, DC, that goes something like
this:
"A few million here, a few million there, pretty soon you'll be talking
real money."
After I cleaned up the typos, I averaged .11 seconds in ten sample runs
(versus .14). For one message, it's nothing. But when you're pumping
through hundreds of thousands of messages per day, that's nothing to sneeze
at.
It's unfortunate to see that the "wasteful, bloated, inefficient code is
OK, as long as you have a fast CPU" mantra being adopted by anyone else
other than Microsoft.
I recall that the original excuse for this absurd logic was that it's too
gosh darn difficult to properly check the return value from a
multicharacter write() call.
My heart bleeds for you.
--
Sam