Skip to content

Commit 846839e

Browse files
author
Geoffrey Broadwell
committed
Add more microbenchmarks, this time for multiple ways to visit all indices for a 2D array
1 parent 99da16f commit 846839e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

microbenchmarks.pl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,28 @@
162162
perl6 => 'my $s = " " x 1000 ~ "x" x 1000 ~ " " x 1000; $s.trim for 1 .. 1000',
163163
nqp => undef,
164164
},
165+
{
166+
name => 'visit_2d_indices_while',
167+
perl5 => 'my $i = 0; while ($i < 100) { my $j = 0; while ($j < 100) { $i + $j; $j++ }; $i++ }',
168+
perl6 => 'my $i = 0; while ($i < 100) { my $j = 0; while ($j < 100) { $i + $j; $j++ }; $i++ }',
169+
nqp => 'my $i := 0; while ($i < 100) { my $j := 0; while ($j < 100) { $i + $j; $j := $j + 1 }; $i := $j + 1 }',
170+
},
171+
{
172+
name => 'visit_2d_indices_loop',
173+
perl5 => 'for (my $i = 0; $i < 100; $i++) { for (my $j = 0; $j < 100; $j++) { $i + $j } }',
174+
perl6 => 'loop (my $i = 0; $i < 100; $i++) { loop (my $j = 0; $j < 100; $j++) { $i + $j } }',
175+
nqp => undef,
176+
},
177+
{
178+
name => 'visit_2d_indices_for',
179+
perl5 => 'for my $i (0 .. 99) { for my $j (0 .. 99) { $i + $j } }',
180+
perl6 => 'for ^100 -> $i { for ^100 -> $j { $i + $j } }',
181+
nqp => undef,
182+
},
183+
{
184+
name => 'visit_2d_indices_cross',
185+
perl5 => undef,
186+
perl6 => 'for ^100 X ^100 -> $i, $j { $i + $j }',
187+
nqp => undef,
188+
},
165189
]

0 commit comments

Comments
 (0)