Re: Why does Perl get slower when building a larger hash? (Not due to the memory swapping)by kcott (Canon)
|on Mar 01, 2013 at 02:37 UTC||Need Help??|
Welcome to the monastery.
The first thing I'd suggest doing is adding use warnings; (warnings) after use strict; and fix up problems that are reported. There may be others, but a couple that grabbed my attention were close IN; (a filehandle that is never opened) and my %hash1; ... my %hash1 ... (declared twice in same scope - ditto for %hash2).
One place where I believe you're doing unnecessary processing is:
Rather than performing all those hash dereferences, I believe you could simply write something like:
You'd need to handle other references to %hash1 and %hash2 in a similar fashion. At the very least, I don't believe you need to create the intermediate hash %file_genes: you could just create %hash1 and %hash2 directly, like this: