Hi Kimoto,
Птн Окт 06 10:11:19 2017, kimoto.yuki@gmail.com писал:
Show quoted text> new_int_array is data conversion function, not calculate total value.
>
Perhaps, but its results are erroneous and slower than the pure Perl.
Show quoted text> If you want to calculate total of 1..100_000, please write the following.
>
> # lib/Foo.spvm
> package Foo {
> sub sum() : void {
> my $total = 0;
> for (my $i = 0; $i < 100_000; $i++) {
> $total += $i;
> }
> std::say_int($total);
> }
> }
Here too the result turns out bad
704982704
:(
Please to check by yourself.
Show quoted text>
> 2017-10-04 17:23 GMT+09:00 Alessandro Gorohovski via RT <
> bug-SPVM@rt.cpan.org>:
>
> > Wed Oct 04 04:23:15 2017: Request 123188 was acted upon.
> > Transaction: Ticket created by DONANGEL
> > Queue: SPVM
> > Subject: SPVM is slow and incorrectly calculates
> > Broken in: (no value)
> > Severity: Critical
> > Owner: KIMOTO
> > Requestors: DONANGEL@cpan.org
> > Status: new
> > Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=123188 >
> >
> >
> > Hi Kimoto,
> >
> > Sorry, I have tested/checked your module and got following results
> > for array [1..100_000].
> >
> > 1)
> > Your module (see your example) wuth
> > my $sp_nums = SPVM::new_int_array( [ 1..100_000 ] );
> > is:
> > $ time ./SPVM-Native_example.pl
> > 705082704
> >
> > real 0m0.241s
> > user 0m0.216s
> > sys 0m0.020s
> >
> > 2)
> > A sample pure perl:
> > $ time perl -E '$t += $_ for 1..100_000; say $t'
> > 5000050000
> >
> > real 0m0.018s
> > user 0m0.016s
> > sys 0m0.004s
> >
> > Yes,
> > Sum of from 1 to 100_000 is 100_000*100_001/2 = 5000050000
> >
> > What do you think
> > ?
> >