You will see many small numbers, typically between 1/1000 and 1/100 of the
total memory used, or absolutely in the range of 250 bytes to a few K. It
should however be realised that the numbers found usually apply per thread
_and_ per module loaded. So assuming you have 10 modules loaded (which is
about the minimum when you're using threads), and you would be able to save
1K of memory for each module, then you would be saving 10K per
thread. Which quickly grows to 1 Mbyte if you're running with 100 threads.
All of the benchmarks I will be sending to p5p will have the [Memory]
indicator in the subject. So you should be able to ignore them without
having to read them.
All the benchmarks are based on the Benchmark::Thread::Size module,
available from CPAN (renamed from Thread::Benchmark::Size, as suggested by
Arthur Bergman). I can only do these benchmarks on Linux systems. I would
appreciate it if other people could run these benchmarks on the same or
other architectures to really see if they are applicable generally.
Typical source for a test is as easy as:
=== testvars =============================================================
use Benchmark::Thread::Size bare => <<'EOD1', full => <<'EOD2', vars =>
<<'EOD3', our => <<'EOD4', unique => <<'EOD5';
$VERSION = '0.01';
EOD1
$main::VERSION = '0.01';
EOD2
use vars qw($VERSION);
$VERSION = '0.01';
EOD3
our $VERSION = '0.01';
EOD4
our $VERSION : unique = '0.01';
EOD5
==========================================================================
Thank you all for your time! And hopefully we'll be able to make Perl 5 a
meaner and leaner beast.
Liz