October 15, 2004
Ben Hinkle wrote:

> I've attached a modified version of std.stdio that builds up a buffer
> before calling file I/O. I'd be curious if it speeds up your code. Replace
>    import std.stdio;
> replaced with
>    import stdio2;
> and compile in stdio2.d with your application.
> 
> Note the attached file doesn't handle the wide case. I only did the fputc case. Also it uses a buffer size of 32 as a guess - bigger might waste time initializing array elements that aren't used.
> 
> -Ben

Looking at that code again my second modification in the non-ASCII cased is hosed. I just copy-and-pasted and forgot to update the variable name. So only call it with ASCII. I'll probably do some more experiments to see what buffer size is best and send something to Walter.

-Ben
October 16, 2004
"Ben Hinkle" <bhinkle4@juno.com> wrote in message news:ckplmr$2sr5$1@digitaldaemon.com...
> Ben Hinkle wrote:
>
> > I've attached a modified version of std.stdio that builds up a buffer before calling file I/O. I'd be curious if it speeds up your code.
Replace
> >    import std.stdio;
> > replaced with
> >    import stdio2;
> > and compile in stdio2.d with your application.
> >
> > Note the attached file doesn't handle the wide case. I only did the
fputc
> > case. Also it uses a buffer size of 32 as a guess - bigger might waste time initializing array elements that aren't used.
> >
> > -Ben
>
> Looking at that code again my second modification in the non-ASCII cased
is
> hosed. I just copy-and-pasted and forgot to update the variable name. So only call it with ASCII. I'll probably do some more experiments to see
what
> buffer size is best and send something to Walter.

I don't believe the buffer size is the problem. The problem is that the lock should be surround all the calls to fputc, not embedded within fputc. Look at the implementation of printf in \dm\src\core\printf.c.


October 16, 2004
"Walter" <newshound@digitalmars.com> wrote in message news:ckq78u$6eo$1@digitaldaemon.com...
>
> "Ben Hinkle" <bhinkle4@juno.com> wrote in message news:ckplmr$2sr5$1@digitaldaemon.com...
> > Ben Hinkle wrote:
> >
> > > I've attached a modified version of std.stdio that builds up a buffer before calling file I/O. I'd be curious if it speeds up your code.
> Replace
> > >    import std.stdio;
> > > replaced with
> > >    import stdio2;
> > > and compile in stdio2.d with your application.
> > >
> > > Note the attached file doesn't handle the wide case. I only did the
> fputc
> > > case. Also it uses a buffer size of 32 as a guess - bigger might waste time initializing array elements that aren't used.
> > >
> > > -Ben
> >
> > Looking at that code again my second modification in the non-ASCII cased
> is
> > hosed. I just copy-and-pasted and forgot to update the variable name. So only call it with ASCII. I'll probably do some more experiments to see
> what
> > buffer size is best and send something to Walter.
>
> I don't believe the buffer size is the problem. The problem is that the
lock
> should be surround all the calls to fputc, not embedded within fputc. Look at the implementation of printf in \dm\src\core\printf.c.

I just meant the buffer size shouldn't be so big that the average time spent initialzing unused elements is greater than the average time spent flushing. Off the top of my head that size is probably pretty big but who knows - it is system dependent. I'll check out the printf code - where is it? I can't find it in the dmd.zip download.


October 16, 2004
"Ben Hinkle" <bhinkle@mathworks.com> wrote in message news:cks3uo$1oao$1@digitaldaemon.com...
>
> "Walter" <newshound@digitalmars.com> wrote in message news:ckq78u$6eo$1@digitaldaemon.com...
> > I don't believe the buffer size is the problem. The problem is that the
lock
> > should be surround all the calls to fputc, not embedded within fputc.
Look
> > at the implementation of printf in \dm\src\core\printf.c.
>
> I just meant the buffer size shouldn't be so big that the average time
spent
> initialzing unused elements is greater than the average time spent
flushing.
> Off the top of my head that size is probably pretty big but who knows - it is system dependent. I'll check out the printf code - where is it? I can't find it in the dmd.zip download.

It's on the DMC++ CD in \dm\src\core\printf.c


1 2
Next ›   Last »