I'm seeing a strange error. I started trying out Marc's original code,
then tried to adapt some Perl5-type solutions from SO to see how they
performed when re-written as Perl6. One thing I wanted to explicitly
test was how restricting to an "Int" type affected performance.

However, I found a surprising result: a sequence of one-million Ints
throws an error, but a sequence of 999,999 Ints does not:

> mbook:~ homedir$ seq 1000000 | time perl6 -e 'say [+] lines'
> 500000500000
>         4.81 real         4.86 user         0.20 sys
> mbook:~ homedir$ seq 1000000 | time perl6 -ne 'my $y += $_; END { print $y; }'
> 500000500000        4.88 real         5.06 user         0.19 sys
> mbook:~ homedir$ seq 1000000 | time perl6 -ne 'my Int $y += $_; END { print 
> $y; }'
> Type check failed in assignment to $y; expected Int but got Num 
> (500000500000e0)
>   in block <unit> at -e line 1
> 499999500000        4.77 real         4.97 user         0.19 sys
> mbook:~ homedir$ seq 999999 | time perl6 -ne 'my Int $y += $_; END { print 
> $y; }'
> 499999500000        4.86 real         5.05 user         0.19 sys
> mbook:~ homedir$ perl6 -v
> This is Rakudo version 2019.07.1 built on MoarVM version 2019.07.1
> implementing Perl 6.d.
> mbook:~ homedir$

Any comments or explanation appreciated,

Best Regards, Bill.




On Tue, Sep 24, 2019 at 1:59 AM Marc Chantreux <e...@phear.org> wrote:
>
> hello,
>
> > > > > nice ... but when x is ~ 75440 (not always), there is a problem
> > > > What is x here?
> > > sorry. x is the arg of seq (number of lines).
> > That never happens on my laptop
>
> well.. so it's a problem with my station. nevermind :)
>
> thanks again for helping
> marc

Reply via email to