Skip to content

Commit 0923c8d

Browse files
author
Geoffrey Broadwell
committed
Add NQP version of split_string_constant
Also switch Perl 5 and Perl 6 variants to while loops to match NQP, and add regex tag to split_string_regex.
1 parent 1e57fe1 commit 0923c8d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

microbenchmarks.pl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,16 +293,16 @@
293293
},
294294
{
295295
name => 'split_string_constant',
296-
tags => [qw( for string )],
296+
tags => [qw( while string )],
297297
scale => 1 << 7,
298298
work => sub { $_[0] * $_[0] },
299-
perl5 => 'my $s = join ", " => 1 .. SCALE; my @s = split ", " => $s for 1 .. SCALE',
300-
perl6 => 'my $s = (1 .. SCALE).join: ", "; my @s = $s.split(", ") for 1 .. SCALE',
301-
nqp => undef,
299+
perl5 => 'my $s = join ", " => 1 .. SCALE; my $i; my @s = split ", " => $s while ++$i <= SCALE',
300+
perl6 => 'my $s = (1 .. SCALE).join: ", "; my $i; my @s = $s.split(", ") while ++$i <= SCALE',
301+
nqp => 'my @i; my $i := 0; while ($i := $i + 1) <= SCALE { nqp::push(@i, ~$i); }; my $s := nqp::join(", ", @i); $i := 0; while ($i := $i + 1) <= SCALE { my @s := nqp::split(", ", $s) }',
302302
},
303303
{
304304
name => 'split_string_regex',
305-
tags => [qw( for string )],
305+
tags => [qw( for string regex )],
306306
scale => 1 << 7,
307307
work => sub { $_[0] * $_[0] },
308308
perl5 => 'my $s = join ", " => 1 .. SCALE; my @s = split /\s*,\s*/ => $s for 1 .. SCALE',

0 commit comments

Comments
 (0)