Skip to content

Instantly share code, notes, and snippets.

@salortiz
Created March 9, 2016 06:58
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save salortiz/6e2cb6607ae1387e3e13 to your computer and use it in GitHub Desktop.
CArray creation
use v6;
use Bench;
use NativeCall;
my $b = Bench.new;
my $small = Buf.new(0 xx 100);
my $medium = Buf.new(0 xx 1000);
my $large = Buf.new(0 xx 10000);
$b.timethese(1000, {
empty => { CArray[uint8].new },
sml-clas => { CArray[uint8].new($small.list) },
med-clas => { CArray[uint8].new($medium.list) },
lge-clas => { CArray[uint8].new($large.list) },
});
$ perl6 -v
This is Rakudo version 2015.12 built on MoarVM version 2015.12
implementing Perl 6.c.
[sog@monica Blob]$ perl6 benchCA.pl6
Benchmark:
Timing 1000 iterations of empty, lge-clas, med-clas, sml-clas...
empty: 0.0240 wallclock secs @ 41743.6036/s (n=1000)
lge-clas: 27.9823 wallclock secs @ 35.7369/s (n=1000)
med-clas: 2.8243 wallclock secs @ 354.0723/s (n=1000)
sml-clas: 0.3700 wallclock secs @ 2702.5661/s (n=1000)
$ 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 benchCA.pl6
Benchmark:
Timing 1000 iterations of empty, lge-clas, med-clas, sml-clas...
empty: 0.0248 wallclock secs @ 40267.1151/s (n=1000)
lge-clas: 613.7717 wallclock secs @ 1.6293/s (n=1000)
med-clas: 89.0139 wallclock secs @ 11.2342/s (n=1000)
sml-clas: 9.0680 wallclock secs @ 110.2779/s (n=1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment