develooper Front page | perl.perl5.porters | Postings from November 2010

Re: why is the perlio buffer hard-wired to 4K?

Thread Previous | Thread Next
From:
Craig A. Berry
Date:
November 9, 2010 12:54
Subject:
Re: why is the perlio buffer hard-wired to 4K?
Message ID:
AANLkTimrXTrCa8ekQ+1VTuwZ=qvL-yG7czm9Rbetx+V1@mail.gmail.com
On Tue, Nov 9, 2010 at 1:24 PM, Andy Dougherty <doughera@lafayette.edu> wrote:

> I'd do it like this (untested, so I haven't pushed it myself).
> This also offers an easy way to adjust it with Configure, using
> something like
>
>        sh Configure -Accflags=-DPERLIO_BUFSIZ=8192
>
> I could see doing some further Configure tinkering so that an equivalent
> command would be
>
>        sh Configure -Dperlio_bufsiz=8192
>
> but this should be good for now.
>
> --- perl-current/perlio.c       2010-11-09 10:36:16.000000000 -0500
> +++ perl-andy/perlio.c  2010-11-09 10:42:36.272133184 -0500
> @@ -4112,6 +4112,14 @@
>     return 0;
>  }
>
> +#ifndef PERLIO_BUFSIZ
> +#  ifdef BUFSIZ
> +#    define PERLIO_BUFSIZ BUFSIZ
> +#  else
> +#    define PERLIO_BUFSIZ 4096
> +#  endif
> +#endif
> +
>  STDCHAR *
>  PerlIOBuf_get_base(pTHX_ PerlIO *f)
>  {
> @@ -4120,7 +4128,7 @@
>
>     if (!b->buf) {
>        if (!b->bufsiz)
> -           b->bufsiz = 4096;
> +           b->bufsiz = PERLIO_BUFSIZ;
>        Newxz(b->buf,b->bufsiz, STDCHAR);
>        if (!b->buf) {
>            b->buf = (STDCHAR *) & b->oneword;

Thanks, that makes a lot of sense.  I think I'll do making it a macro
and changing the default size in separate commits so it's easier to
cherry pick the former.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About