Open MasterDuke17 opened 1 year ago
A raku -e '"foo" ~~ s:g:i/O/x/'
is a shorter golf.
Even shorter: raku -e '"o" ~~ m:g:i/O/'
FWIW, changing the nqp::indexingoptimized
to an nqp::decont
or nqp::clone
(or either combination of both of them) instead of removing it doesn't fix the error.
This used to be an optimization, but it seems like it isn't needed anymore.
Two test cases don't show any significant change in runtime, and only a very small reduction in memory use. However, maybe these test cases aren't actually that great?
/usr/bin/time raku -e 'srand 1; my $a = ("a".."z", "«", "»", 0..9).flat.roll(100_000).join; my $b; my $s = now; $b = $a ~~ /\d\w+\d/ for ^100_000; say now - $s; say $b'
and/usr/bin/time raku -e 'my $page = ("abc" ~ "d" xx 70) x 70; my $a; my $s = now; $a = $page ~~ m/ a (.+) c / for ^100; say now - $s; say $a.chars;'
Currently this causes an
Iteration past end of grapheme iterator
exception in both the NQP tests and the Rakudo tests. But I'm not sure if it's just uncovering an existing bug, or collapsing the strand really is required.@jnthn ping