-
-
Save salortiz/4ef300b4d7f2e9738024 to your computer and use it in GitHub Desktop.
Slurpy Buf.list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ perl6 -v | |
This is Rakudo version 2015.12 built on MoarVM version 2015.12 | |
implementing Perl 6.c. | |
[sog@monica Blob]$ perl6 bench.pl6 | |
Benchmark: | |
Timing 1000 iterations of list, passli... | |
list: 1.2851 wallclock secs @ 778.1340/s (n=1000) | |
passli: 1.3605 wallclock secs @ 735.0190/s (n=1000) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ perl6 -v | |
This is Rakudo version 2016.02-27-g2afe79f built on MoarVM version 2016.02 | |
implementing Perl 6.c. | |
[sog@monica Blob]$ perl6 bench.pl6 | |
Benchmark: | |
Timing 1000 iterations of list, passli... | |
list: 1.4013 wallclock secs @ 713.6286/s (n=1000) | |
passli: 1.6245 wallclock secs @ 615.5784/s (n=1000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
use Bench; | |
my $b = Bench.new; | |
my $buf = Buf.new(0 xx 1000); | |
#multi sub foo(@vals) { @vals.elems }; | |
#multi sub foo(*@vals) { foo(@vals) }; | |
sub foo(*@vals) { @vals.elems }; | |
$b.timethese(1000, { | |
list => { my @li = $buf.list; foo(@li); }, | |
passli => { foo($buf.list) }, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ perl6 -v | |
This is Rakudo version 2016.02-30-gf25d41c built on MoarVM version 2016.02 | |
implementing Perl 6.c. | |
[sog@monica Blob]$ perl6 bench.pl6 | |
Benchmark: | |
Timing 1000 iterations of list, passli... | |
list: 1.2354 wallclock secs @ 809.4610/s (n=1000) | |
passli: 26.6272 wallclock secs @ 37.5556/s (n=1000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ perl6 -v | |
This is Rakudo version 2016.02-100-g4a0ba74 built on MoarVM version 2016.02-8-ga329e2d | |
implementing Perl 6.c. | |
[sog@monica Blob]$ perl6 bench.pl6 | |
Benchmark: | |
Timing 1000 iterations of list, passli... | |
list: 1.2906 wallclock secs @ 774.8104/s (n=1000) | |
passli: 28.7112 wallclock secs @ 34.8296/s (n=1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The real problem isn't the change in Blob/Buf.list, but the really bad interactions between an Interator / Seq vs an slurpy argument, as proved by uncommenting the multis in bench.pl above.
So the solution to the original issue (creating a CArray from a Buf) can be solved adding a non slurpy candidate
CArray.new(@vals)