Hello,
Although I'm not an expert I suspect you will be faster doing
$SIGNALS{$SIGNALNAME}= {isINPUTof=>[$1], isOUTPUTof=>[$2]};
instead of predeclaring memory & pushing onto arrays. The above line should
do all of that in one.
Also, no need to test for existence of the key if you are happy that the
key values are overwritten if the key already exists.
Joe
Tonuzi Selim <[EMAIL PROTECTED]>@listserv.ActiveState.com on 10/09/2002
13:23:51
Sent by: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc:
Subject: Is there a perl Guru that can help me ?
Hi,
I am sorry but I am not a programmer and I have no
knowledge in C.
I use Perl but every time, people get interest in my
program and want it. I am trying to make it fast.
I am parsing a text file that contains instances and
wires linking these instances.
I have millions of signals and I have some questions
that might sounds stupid to programmes like you.
first point :
I have a hash with millions of keys.
$SIGNALS{$SIGNALNAME}->{INPUTS} = [];
$SIGNALS{$SIGNALNAME}->{OUTPUT} = [];
$SIGNALS{$SIGNALNAME}->{LEVEL} = [];
every time a get a txt portion describing a signal:
I do the following thing :
unless (exists $SIGNALS{$SIGNALNAME}) {
$SIGNALS{$SIGNALNAME}={};
$SIGNALS{$SIGNALNAME}->{isINPUTof}=[];
}
push(@{$SIGNALS{$SIGNALNAME}->{isINPUTof}},$1);
push(@{$SIGNALS{$SIGNALNAME}->{isOUTPUTof}},$2);
...
As I have millions of signals, I am trying to optimize
some things.
the keys are about 50 letters.
is it better to do the following thing ?
$tmp = $SIGNALS{$SIGNALSNAME}
push(@{$tmp->{isINPUTof}},$1);
push(@{$tmp->{isOUTPUTof}},$2);
Would it be faster to replace 'isINPUTof' by 'I' and
isOUTPUTof by 'O' ?
I can't benchmark it because it will take days.
Can somebody help me ?
___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en fran�ais !
Yahoo! Mail : http://fr.mail.yahoo.com
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs