Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add a push-then-join test (with scaling); increase an old 1e3 limit t…
…o 1e4
  • Loading branch information
Geoffrey Broadwell committed Dec 7, 2012
1 parent 23baaf3 commit 2253bd1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
1 change: 0 additions & 1 deletion TODO
Expand Up @@ -34,7 +34,6 @@
- dice.pl
- mandelbrot-*.pl
+ diakopter++'s ideas:
- Push-then-join to contrast with the separate push and concat tests
- String split using fixed string
- String split using regex
- Closure creation/invocation
Expand Down
26 changes: 19 additions & 7 deletions microbenchmarks.pl
Expand Up @@ -43,10 +43,22 @@
nqp => 'my $s := ""; my $i := 0; while ($i := $i + 1) <= 100000 { $s := $s ~ "x" }',
},
{
name => 'while_push_1e3',
perl5 => 'my @a; my $i = 0; while (++$i <= 1000) { push @a, 1 }',
perl6 => 'my @a; my $i = 0; while (++$i <= 1000) { push @a, 1 }',
nqp => 'my @a; my $i := 0; while ($i := $i + 1) <= 1000 { @a.push(1) }',
name => 'while_push_join_1e4',
perl5 => 'my @a; my $i = 0; while (++$i <= 10000) { push @a, "x" }; my $s = join "" => @a;',
perl6 => 'my @a; my $i = 0; while (++$i <= 10000) { @a.push("x") }; my $s; $s = @a.join;',
nqp => 'my @a; my $i := 0; while ($i := $i + 1) <= 10000 { @a.push("x"); }; my $s := nqp::join("",@a);',
},
{
name => 'while_push_join_1e5',
perl5 => 'my @a; my $i = 0; while (++$i <= 100000) { push @a, "x" }; my $s = join "" => @a;',
perl6 => 'my @a; my $i = 0; while (++$i <= 100000) { @a.push("x") }; my $s; $s = @a.join;',
nqp => 'my @a; my $i := 0; while ($i := $i + 1) <= 100000 { @a.push("x"); }; my $s := nqp::join("",@a);',
},
{
name => 'while_push_1e4',
perl5 => 'my @a; my $i = 0; while (++$i <= 10000) { push @a, 1 }',
perl6 => 'my @a; my $i = 0; while (++$i <= 10000) { push @a, 1 }',
nqp => 'my @a; my $i := 0; while ($i := $i + 1) <= 10000 { @a.push(1) }',
},
{
name => 'while_array_set_1e4',
Expand Down Expand Up @@ -109,9 +121,9 @@
nqp => undef,
},
{
name => 'for_push_1e3',
perl5 => 'my @a; for (1 .. 1000) { push @a, 1 }',
perl6 => 'my @a; for (1 .. 1000) { push @a, 1 }',
name => 'for_push_1e4',
perl5 => 'my @a; for (1 .. 10000) { push @a, 1 }',
perl6 => 'my @a; for (1 .. 10000) { push @a, 1 }',
nqp => undef,
},
{
Expand Down

0 comments on commit 2253bd1

Please sign in to comment.