Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: How to process with huge data's

by Anonymous Monk
on Oct 04, 2011 at 14:48 UTC ( #929561=note: print w/replies, xml ) Need Help??

in reply to How to process with huge data's

I don't see major faults in your script, but that much data should easily be calculated within a few minutes, if not seconds. However, here are a few problems.

Drop the $inputtext = $_ assignment, and change your top-level regexps to have an anchor in the beginning:

if (m/^q (\d+) (\d+)/)

Second, the m/\b$fnum\b[^\|]*\b$snum\b/ regexps are forcing the regexp engine to recompile that on almost every run (as the variables change). This is highly inefficient -- the whole if/elsif/else chain should be parsed differently. I'm not sure what the purpose of that block is, but at the very least you can change some of $fnum/$snum into \d+

Replies are listed 'Best First'.
Re^2: How to process with huge data's
by Anonymous Monk on Oct 04, 2011 at 14:52 UTC

    Er, one major fault after all: You seem to be building a huge string called $connectionText, and running loads of regexps on it. You should look into replacing it -- a hash might be suitable.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://929561]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2017-12-11 08:21 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (288 votes). Check out past polls.