[Pdx-pm] RE: [Pdx-pm] Software development and The Rules

Joshua Keroes jkeroes at eli.net
Wed Sep 25 18:10:38 CDT 2002


On (Wed, Sep 25 16:03), Curtis Poe wrote:
> ----- Original Message -----
> From: "Joshua Keroes" <jkeroes at eli.net>
> 
> > Nope, that's not it. For one thing, you've just read 1_000_000
> > numbers into memory, that's 7 bytes * 1_000_000 of space of the
> > disk.
> >
> > -Joshua
> 
> Whoops!  We're talking Perl here :)  I don't have hard numbers, but I
> estimate that a simple scalar in Perl has at least 12 bytes: 4 for the
> pointer, 4 for the reference count, 3 for the flags and 1 (?) for the type;
> see perlguts for more info.  Abigail has stated that there is actually 24
> bytes of overhead per scalar
> (http://www.perlmonks.org/index.pl?node_id=190458 -- any Perl internals
> gurus care to illuminate me on what I missed?).
> 
> As a result, if Abigail's figure is correct, that's 24_000_000 bytes plus
> 7_000_000 bytes, for a total of 31_000_000 bytes of memory for one million
> phone numbers.

Given Unicode these days, it may even be twice that. So the point stands,
there is a solution to this problem that is much better than allocating
20-30 MB of RAM.

-J



More information about the Pdx-pm-list mailing list