Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add the first Perl 6 stress test: divide-and-conquer
  • Loading branch information
Geoffrey Broadwell committed Oct 29, 2014
1 parent 4107f13 commit 1a31fa5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions minibenchmarks.pl
Expand Up @@ -106,4 +106,14 @@
perl6 => [qw( BENCH/perl6/string-escape SCALE )],
nqp => undef,
},
{
name => 'divide-and-conquer',
skip => [qw( )],
tags => [qw( stress threads )],
scale => 0,
expected => "1\n",
perl5 => undef,
perl6 => [qw( BENCH/perl6/divide-and-conquer SCALE )],
nqp => undef,
},
]
11 changes: 11 additions & 0 deletions perl6/divide-and-conquer
@@ -0,0 +1,11 @@
my \SCALE = @*ARGS[0];
my \FANOUT = 2;

sub divide-and-conquer($n, $depth) {
say "$depth: $n" if 0;
$depth <= 0 ?? $n !! [+] await do for ^FANOUT {
start { divide-and-conquer($n / FANOUT, $depth - 1) }
}
}

say divide-and-conquer(1.0, SCALE);

0 comments on commit 1a31fa5

Please sign in to comment.