develooper Front page | perl.perl5.porters | Postings from March 2000

Storage of blessed name for thousands of objects

Thread Previous
Matt Sergeant
March 10, 2000 06:12
Storage of blessed name for thousands of objects
Message ID:
I heard somewhere (I think it was in a rudimentary scan of perldelta) that
repeated hash keys are only stored once:

$a->{Fred}->{wife} = 'Wilma';
$a->{Barney}->{wife} = 'Betty';

Means you only store one instance of 'wife' - is that right?

So does perl do the same for the blessed name:

bless \$a, 'myobject';
bless \$b, 'myobject';

Does that store 'myobject' once or twice?

If its twice I'd _really_ appreciate looking into storing it once - I have
a module (XML::XPath) that potentially stores many thousands of blessed
refs of the same type, and it gobbles memory like crazy, and I think this
might be a big win for saving RAM. I do everything else I can - use arrays
instead of hashes, don't expand my array beyond what's required, etc.


Details: FastNet Software Ltd - XML, Perl, Databases.
Tagline: High Performance Web Solutions
Web Sites:
Available for Consultancy, Contracts and Training.

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About