Re: efficiency of hash of hashes/lists

2005-05-24 Thread Dave Gray
On 5/23/05, Peter Rabbitson [EMAIL PROTECTED] wrote: On Mon, May 23, 2005 at 01:40:08PM -0400, Zhenhai Duan wrote: I tried hash (where the members of a group are joined with :), and hash of hash. It happended that hash of hash is slower than single hash. Hash: $groups{$g1} =

Re: efficiency of hash of hashes/lists

2005-05-24 Thread Philip M. Gollucci
Dave Gray wrote: On 5/23/05, Peter Rabbitson [EMAIL PROTECTED] wrote: On Mon, May 23, 2005 at 01:40:08PM -0400, Zhenhai Duan wrote: I tried hash (where the members of a group are joined with :), and hash of hash. It happended that hash of hash is slower than single hash. Hash:

Re: efficiency of hash of hashes/lists

2005-05-24 Thread Dave Gray
# access test for 2d ($su, $ss) = times; for my $i (0 .. $hashsize-1) { $oned{$l1[$i]}{$l2[$i]}++ I think you should be operating on %twod here. LOL, thanks. Original poster take note: generating hashes..! base 0.03 0.00 0.03 1D 0.24

Re: efficiency of hash of hashes/lists

2005-05-23 Thread Zhenhai Duan
I tried hash (where the members of a group are joined with :), and hash of hash. It happended that hash of hash is slower than single hash. Hash: $groups{$g1} = $member1:$member2; Hash of hash $groups{$g1}{$member1} = 1; Method 1 is faster, even I need to do a split to get the members.

Re: efficiency of hash of hashes/lists

2005-05-23 Thread Peter Rabbitson
On Mon, May 23, 2005 at 01:40:08PM -0400, Zhenhai Duan wrote: I tried hash (where the members of a group are joined with :), and hash of hash. It happended that hash of hash is slower than single hash. Hash: $groups{$g1} = $member1:$member2; Hash of hash $groups{$g1}{$member1} = 1;

efficiency of hash of hashes/lists

2005-05-22 Thread Zhenhai Duan
Hi, I am wondering if the performance (time efficiency) of hash of hash is bad. I has this impression from the code I developed. Basically my structure needs to hold the members of different groups. I have different choices: hash: $groups{$g1} = $member1:$member2:$member3...; but everytime

Re: efficiency of hash of hashes/lists

2005-05-22 Thread Jeff 'japhy' Pinyan
On May 22, Zhenhai Duan said: I am wondering if the performance (time efficiency) of hash of hash is bad. I has this impression from the code I developed. Basically my structure needs to hold the members of different groups. I have different choices: hash of hash $groups{$g1}{$member1} = 1;

RE: efficiency of hash of hashes/lists

2005-05-22 Thread Charles K. Clarkson
Zhenhai Duan mailto:[EMAIL PROTECTED] wrote: : Can anyone give me some suggestions which one is better? Whichever is easiest to read is probably the better solution. Unless you are dealing with a finished program where you need additional speed, let readability be your guide. HTH, Charles