good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Subroutine overhead in Perlby Joost (Canon) |
on Nov 06, 2007 at 18:19 UTC ( [id://649303]=note: print w/replies, xml ) | Need Help?? |
You have a bunch of constructs in grid_check() like this:
Where it looks like @list (and a whole lot more stuff) is created by each call to grid_check(). Generally, you want recursive functions to pass arguments. (I can't even see if that code would *ever* stop calling itself since I can't see what the stop conditions are). update: just to address your question: perl's subroutine calls aren't exactly the quickest and I wouldn't be surprised if they'd be a lot (maybe even 10 times, if the Java VM can do some good hot spot optimization) slower than Java's, but even considering that, it seems obvious to me that what's really causing a significant slowness is not the function call overhead, so it's probably your algorithm.
In Section
Seekers of Perl Wisdom
|
|