Hmm, you're doing a lot of computing, this is bound to take quite a bit of time. I would suggest that you start by profiling your program to figure out exactly which part of your code is taking long time. You might want to use a tool such a
Devel::NYTProf.