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} =
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:
# 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
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.
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;
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
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;
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