You need to separate out the time it's taking to open the file and do file I/O from the time it's taking to interate over the keys and build the matrix.
Do this: Comment out everything between the tie and the untie (missing, but worth adding for general cleanliness). If this doesn't have a significant impact on runtime, then your answer is "buy a faster disk" (or defrag the one you've got).
Next step is to comment out the code that's building the matrix (after doing each %hash). This retains the disk IO for reading keys, while separating out the overhead for your data structures. If this doesn't have a significant effect of overall runtime, answers range from "buy a faster disk" to "precache the keys in the db".
I really doubt this is due to your matrix building code.
In reply to Re: optimize this code?
by dws
in thread Optimization of DB_File sorting and processing code
by Evanovich
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |