http://www.perlmonks.org?node_id=442495


in reply to Sloooooow algo in Perl

Looking to your code, you don't have nothing I can say: LOOK THERE! IT'S SLOW! Unfortunately. This way can't help you much.

First questions... what is the magnitude order for your @a? Also, your @delta = @sigma = @sigmainit is not efficient if these are big arrays. Also, I can't see where @sigmainit come from.

Also, in your foreach, if @{$p$w} is a big array, a while look is faster.

Hope this all helps you a bit. But It's hard to look to your algorithm without more information and understand what it should do.

Alberto Simões