I have a Perl script which reads two files and processes them.
The first file - info file - I store it as a hash (3.5 gb)
The second file - taregt file - I am processing by using information from the info file and other subroutines as designed. (This file, target, ranges from 30 - 60 gb)
So far working are:
- reading the info file into a hash
- breaking the target file into chunks
I want to run on all chunks in parallel:
while(chunks){
# do something
sub a {}
sub b {}
}
So basically, I want to read a chunk, write its output and do this for multiple chunks at the same time. The while loop reads each line of a chunk file, and calls on various subroutine for processing.
Is there a way that I can read chunks in background?
I don't want to read info file for every chunk as it is 3.5gb long and I am reading it into hash, which takes up 3.5gb everytime.
Right now the script takes 1 - 2hrs to run for 30-60gb.