Think about Loose Coupling | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Since you say that the process is getting slower and is not
using much cpu, then it is probably swapping.
In order to speed it up, you need to avoid loading the whole file (or buy more memory :) Things might be much faster for a method that goes through the file several times, as you probably don't store the file on tapes. According to your description, the record number doesn't matter to you much. Why do you use the increment-until-unique method? It might be enough to give a new number. If this method is important to you, then why not do a first pass on the file to find the maximum and then just assign an increasing number starting from that? If you need to be really strict with this, and the record numbers are usually in increasing order, don't forget to start the search from the last place you stopped. To summerize: - Read a record at a time - Favor multiple passes. - Try to stuff the least possible into the hashes In reply to Re: Efficiency and Large Arrays
by fundflow
|
|