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!