in reply to performance problems with renaming multiple files using another file name
Offhand, I can think of a few small ideas. I am not sure if there's an algorithmic improvement, but there are definitely some possibilities for improvement:
`mv $file $dir/$filename`;Launching a new process to move a file is silly, especially with backticks as you ignore the results. Use rename instead.
my %hash = %$hash_ref;This could be expensive if there are a lot of entries in the hash. Just dereference the elements you want anyway: exists $hash->{$key}, for example.
/([0-9]{4,8})(.f|r|p)(.*)/You don't use the third capture (and it's a greedy, lots-of-backtracking operation), so you can remove it altogether.
&make_file_hash($fasta_file);This won't have any effect on performance to my knowledge, but drop the leading &. It's unnecessary here.
|
|---|