# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #119865] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=119865 >
<masak> r: my $N = 5; my $rx = "a?" x $N ~ "a" x $N; say "a" x $N ~~ /<$rx>/ <camelia> rakudo c0814a: OUTPUT«「aaaaa」» <masak> r: my $N = 32; my $rx = "a?" x $N ~ "a" x $N; say "a" x $N ~~ /<$rx>/ <tadzik> moritz: oh yes, that'd work too <camelia> rakudo c0814a: OUTPUT«(timeout)» * masak submits rakudobug * masak throws in http://swtch.com/~rsc/regexp/regexp1.html as a reference As that page shows, this can be made into a polynomial thing rather than an exponential one, by dealing directly with the NFA. NQP's regex engine should be perfectly suited for this already. Even disregarding that, there are various optimization tricks (à la Perl 5) that can be done to make such a regex do less work.