Skip Menu |
Report information
Id: 128693
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: ajs <ajs [at]>

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)

Subject: Regex optimizer on \s+$ is "dumb as bricks"
From: Aaron Sherman <ajs [...]>
To: perl6-bugs [...]
Date: Thu, 21 Jul 2016 14:14:32 -0400
Download (untitled) / with headers
text/plain 696b
When given a pathological input that will always fail, /\s+$/ seems to take the longest way home. Example in the IRC excerpt, below.

From the IRC discussion:

[14:11] <timotimo> m: use nqp; ((" " x 10000) ~ "end") ~~ / \s+$ /; say now - INIT now
[14:11] <+camelia> rakudo-moar 68afa3: OUTPUT«10.1804368␤»
[14:11] <timotimo> ah. no. it's definitely the regex :)
[14:11] <harmil> nice test case, though!
[14:11] <harmil> I'll submit this. At least it will be useful as a note for the future.
[14:11] <timotimo> our regex optimizer is dumb as bricks ;)

Aaron Sherman, M.:
P: 617-440-4332 Google Talk, Email and Google Plus:
Toolsmith, developer, gamer and life-long student.

Download (untitled) / with headers
text/plain 228b
Oddly, this also takes a very long time, so I'm no longer certain what the slowdown is: time perl6 -e 'my $c = (" " x 10000) ~ "end"; $c ~~ /" " ** 10000..10000 $/ and die' real 0m15.403s user 0m15.329s sys 0m0.046s

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at