Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Write large array to file, very slow

by QM (Parson)
on Aug 20, 2018 at 14:51 UTC ( #1220728=note: print w/replies, xml ) Need Help??


in reply to Write large array to file, very slow

You should also be able to do a merge sort, holding only the most recently read line of each file in memory.

A quick search found File::MergeSort, which seems what you want. It can sort lines based on a key you specify:

Merge keys are extracted from the input lines using a user defined subroutine. Comparisons on the keys are done lexicographically.

While it sorts these keys lexicographically, there is room to munge the keyspace to do as you need. If you want your own sort routine, you can roll your own easily enough.

-QM
--
Quantum Mechanics: The dreams stuff is made of

  • Comment on Re: Write large array to file, very slow

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2021-03-02 21:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (64 votes). Check out past polls.

    Notices?