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


in reply to Re: Efficiency: Recursive functions while de-subbing my program
in thread Efficiency: Recursive functions while de-subbing my program

100,000 function calls is peanuts.

Peanuts are expensive:

sub x{ my( $n ) = @_; $n };; cmpthese -1, { a => q[ my $n; $n += $_ for 1 .. 1e5 ], b => q[ my $n; $n += x($_) for 1 .. 1e5 ] };; Rate b a b 2.14/s -- -80% a 10.7/s 399% --

That's 400% faster; a 4 times improvement; 1/5th of the runtime; simply by avoiding 100,000 function calls.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.