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

Storage of blessed name for thousands of objects

Thread Previous
From:
Matt Sergeant
Date:
March 10, 2000 06:12
Subject:
Storage of blessed name for thousands of objects
Message ID:
00031014132109.28777@dougal.sergeant.org
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.

-- 
<Matt/>

Details: FastNet Software Ltd - XML, Perl, Databases.
Tagline: High Performance Web Solutions
Web Sites: http://come.to/fastnet http://sergeant.org
Available for Consultancy, Contracts and Training.

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About