in reply to Re^4: Counting keys with defined or undefined elements in a hash (behaviour of values())
in thread Counting keys with defined or undefined elements in a hash
Hmmm ... so would it be fair to say that each does use less memory, even though it's slower?
> ... (and create a new scalar for the key, because the keys in hashes are not full blown scalars).Well, actually, in my test script I was doing
while (my (undef, $v) = each %fred)
to avoid that one (at least I hope it avoids it!), but apparently copying the values was enough to make it 6x slower, which really surprised me.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Counting keys with defined or undefined elements in a hash (behaviour of values())
by Aristotle (Chancellor) on Jun 07, 2003 at 02:27 UTC | |
by Oberon (Monk) on Jun 07, 2003 at 02:34 UTC | |
by Aristotle (Chancellor) on Jun 07, 2003 at 10:17 UTC | |
by Oberon (Monk) on Jun 13, 2003 at 18:52 UTC |