in reply to Re: Perl Objects, Internal Representation -- How??
in thread Perl Objects, Internal Representation -- How??
What about hash keys- are they duplicated for each object of the same type?Er, no. Hash keys are generally shared across all hashes, as the following shows. Using the same key for lots of objects uses less memory than a different key for each one:Yes.
$ perl588 -e 'push @f, bless { "foo$_",0 } for 100000..999999; system + "ps -flp $$"' F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY +TIME CMD 0 S davem 6040 17980 81 85 0 - 43121 wait 19:05 pts/2 00:0 +0:04 perl5 $ perl588 -e 'push @f, bless { "foo999999",0 } for 100000..999999; sy +stem "ps -flp $$"' F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY +TIME CMD 0 S davem 6045 17980 96 85 0 - 34173 wait 19:06 pts/2 00:0 +0:03 perl5 $
Dave.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Perl Objects, Internal Representation -- How??
by perrin (Chancellor) on Sep 15, 2006 at 18:30 UTC |