Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Reminder to self: must use Memoize more often!

by tobyink (Abbot)
on Jan 12, 2013 at 14:40 UTC ( #1013043=note: print w/ replies, xml ) Need Help??


in reply to Re: Reminder to self: must use Memoize more often!
in thread Reminder to self: must use Memoize more often!

On my machine at least, fib6 is 4% faster than fib5:

my @fib6_cache; sub fib6 { my $n = shift; $fib6_cache[ $n ] //= $n < 2 ? $n : ( $fib6_cache[ $n-1 ] //= fib6($n-1) ) + ( $fib6_cache[ $n-2 ] //= fib6($n-2) ); }
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'


Comment on Re^2: Reminder to self: must use Memoize more often!
Select or Download Code
Re^3: Reminder to self: must use Memoize more often!
by BrowserUk (Pope) on Jan 12, 2013 at 15:03 UTC

    Fair enough. I guess we're into Benchmark vagaries. (T'was a bit unnecessary given the 1000% already gained :)


    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013043]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2014-09-19 08:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (133 votes), past polls