Cached

use experimental :cached; sub fib-cached($n) is cached { if $n > 1 { return fib-basic($n - 1) + fib-basic($n - 2); } return $n; }
Cached - 1st run 0.0845879 Cached - 2nd run 0.0005003