Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: Making this script process 56,000 lines 5 times faster

by kris004 (Initiate)
on Mar 22, 2018 at 18:53 UTC ( [id://1211560]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Making this script process 56,000 lines 5 times faster
in thread Making this script process 56,000 lines 5 times faster

If I say, read in a 4gb file. Not really a problem with this hosts file. I assumed that if it wasn't line by line, then the whole file would have to be loaded into memory.

  • Comment on Re^4: Making this script process 56,000 lines 5 times faster

Replies are listed 'Best First'.
Re^5: Making this script process 56,000 lines 5 times faster
by LanX (Saint) on Mar 22, 2018 at 18:58 UTC
    Actually your original approach in the OP with for( split ...) had this problem.

    The while(m/.../) here is an iterator, you could operate with a sliding window to read consecutive chunks into memory, and adjust with pos where you left of.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Wikisyntax for the Monastery

      Ah ok, thanks!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2024-04-23 13:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found