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:
ольга крыжановская
Date:
November 9, 2010 11:34
Subject:
Re: why is the perlio buffer hard-wired to 4K?
Message ID:
AANLkTikN1_J-8p+e5z7sNQcXzcsh0v9Ese2kY9xZiJ22@mail.gmail.com
Wouldn't it be useful to define the default buffer size to match the
system's page size, i.e. the output of /usr/bin/pagesize?

Olga

On Tue, Nov 9, 2010 at 8:31 PM, John <j.imrie@virginmedia.com> wrote:
> On 09/11/2010 19:24, Andy Dougherty 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;
>>
> As well as making this a configure option could we not add an
> $IO::BUFFER_SIZE variable, with possibly a power of 2 constraint and may be
> a maximum value to allow Perl programs to tweak the value depending on what
> they are being used for?
>
> John
>



-- 
      ,   _                                    _   ,
     { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
.----'-/`-/     olga.kryzhanovska@gmail.com   \-`\-'----.
 `'-..-| /       http://twitter.com/fleyta     \ |-..-'`
      /\/\     Solaris/BSD//C/C++ programmer   /\/\
      `--`                                      `--`

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