balakrishnan has asked for the wisdom of the Perl Monks concerning the following question:
UPDATE : i used Devel::NYTProf and it helped me lot for fine tuning.
Hi Monks,
I have a perl code which could do the text processing.
It gets a list of records as input,
Help me to fine tune this code.
Hi Monks,
I have a perl code which could do the text processing.
It gets a list of records as input,
And finally, it gives the expected output, but the time taken for processing is not ok for me.mycompany----engineer=====itdept-----33
I printed the time after the every line of processing inside the function Extract().use Time::HiRes qw(time); sub Extract { my ($Line,$Name,$Pattern) = @_; my (@Arr,$CallId); print "Extract begins with the input line $Line\n"; print time,"\n"; @Arr = ($Line =~ m/$Pattern/g); print time,"\n"; $Age = $Arr[$#Arr]; print time,"\n"; $Details{$Age}{$Name} = \@Arr if defined($Age); print time,"\n"; } $str = "mycompany----engineer=====itdept-----33"; $Name = "MyName"; $Pattern = "([a-z]+)\-+([a-z]+)\=+([a-z]+)\-+([0-9]+)"; Extract($str,$Name,$Pattern);
Help me to fine tune this code.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Performance issue
by moritz (Cardinal) on Feb 18, 2009 at 13:57 UTC | |
Re: Performance issue
by ELISHEVA (Prior) on Feb 18, 2009 at 14:08 UTC | |
Re: Performance issue
by graff (Chancellor) on Feb 18, 2009 at 14:49 UTC | |
Re: Performance issue
by ww (Archbishop) on Feb 18, 2009 at 14:01 UTC | |
Re: Performance issue
by targetsmart (Curate) on Feb 18, 2009 at 15:31 UTC | |
Re: Performance issue
by slacker (Friar) on Feb 18, 2009 at 13:57 UTC |
Back to
Seekers of Perl Wisdom