develooper Front page | perl.perl5.porters | Postings from January 2006

Re: possibly (tiny) size saving idea

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
January 28, 2006 12:04
Subject:
Re: possibly (tiny) size saving idea
Message ID:
20060128200438.8718.6@llama.ing-simmons.net
Nicholas Clark <nick@ccl4.org> writes:
>On Wed, Jan 25, 2006 at 10:52:36PM +0200, Jarkko Hietaniemi wrote:
>> nm -P perl (in Linux, -P being the "POSIX" option) tells me that
>> (in x86) the PerlIO_fd_refcnt is 0x2000 or 8 kilobytes.
>> 
>> perlio.c:2227:int PerlIO_fd_refcnt[PERLIO_MAX_REFCOUNTABLE_FD];
>> 
>> perlio.c:59:#define PERLIO_MAX_REFCOUNTABLE_FD 2048
>> 
>> Hmm.  An array of 2048 ints, representing 2048 fds.  Hmm.
>> A smaller array for first, say, 256 fds, then a hash for
>> the rest, or just a hash for all?  I can't off-hand believe
>> that refcounting fds can require blazing speeds.  Or are hashes
>> so big that our space savings just went south?  (The array being
>> a global makes me shiver, too.)
>
>As far as I can tell, the rest of the code won't notice if that array is
>malloc()ed and resized as needed. From what I remember, that would add no
>significant complexity to the code.

It is global so that all threads and pseudo-forks can see it.
It isn't malloc-ed just because the Win32/PerlHost "per-thread" malloc
got in the way. It is possible that the global malloc pool could be used.



>
>Nicholas Clark


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