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.
 -Zhenhai
============================================
Zhenhai Duan Assistant Professor Department of Computer Science Florida State University Tallahassee, FL 32306-4530

Phone: (850) 645-1561
Fax:   (850) 644-0058
Email: [EMAIL PROTECTED]
URL:   http://www.cs.fsu.edu/~duan
=============================================

On Sun, 22 May 2005, Jeff 'japhy' Pinyan wrote:

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;
but this one is really slow from what i see.

How have you seen this to be slow?

--
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %    -- Meister Eckhart


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to