perl6 function call performance regression

2008-08-11 Thread luben karavelov
Hello, In order to measure function call performance I am using simple and dumb fibonacci numbers calculation. It is equivalent to the PIR example in examples/benchmark/fib.pir The perl6 code is : use v6; sub fib ($n){ return $n if $n<2; return fib($n-1)+fib($n-2); } say fib(22); H

Re: implicit & explicit returns

2008-08-26 Thread luben karavelov
Will Coleda wrote: On Tue, Aug 26, 2008 at 10:53 AM, luben <[EMAIL PROTECTED]> wrote: I have noticed that Rakudo (and NQP) generates different PIR code for implicit and explicit returns. Example for implicit return: sub foo($n){ $n; } And example for explicit return: sub foo($n){ return

Re: implicit & explicit returns

2008-08-26 Thread luben karavelov
Will Coleda wrote: On Tue, Aug 26, 2008 at 10:53 AM, luben <[EMAIL PROTECTED]> wrote: Is this on purpose? The implicit return is 4-5 times faster than explicit return. Best regards luben CC'ing perl6-compiler (where rakudo-particular items should go), and wondering if you can attach the gene

Re: implicit & explicit returns

2008-08-26 Thread luben karavelov
Jeff Horwitz wrote: the implicit return is by definition always at the end of a sub and therefore emits a PIR .return(). it's fast and easy. the explicit return, in contrast, could be anywhere in a subroutine, including loops, closures, etc. these constructs are also implemented using parro

Re: Bugs or Unimplemented Features?

2008-06-24 Thread luben karavelov
Ovid wrote: That works just fine, so I know we have types on signatures. But now this fails: # remove the 'Int' and this works sub fact (Int $n) { if 0 == $n { return 1; } else { return $n * fact($n - 1); } } say fact(5); The failure is at runtime, not com