Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: match two files

by hippo (Chancellor)
on Jun 03, 2020 at 09:21 UTC ( #11117636=note: print w/replies, xml ) Need Help??


in reply to match two files

How I can shorter the running time by change some code?

Although it's hard to spot because of the random indenting, you have a pair of nested loops. Inside the inner loop you have this line:

$i++

which serves absolutely no purpose. The first change you should make is therefore to remove this line.

Then you might look at your algorithm. Why are you doing the same processing on the entries in @lines2 over and over again? Just process it once, pop the results in a hash for fast lookup and your code will whizz.

Three more tips:

Good luck.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11117636]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2020-10-29 11:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (270 votes). Check out past polls.

    Notices?